Merge remote-tracking branch 'origin/master'

This commit is contained in:
Roman Shevchenko
2018-09-28 18:26:28 +02:00
298 changed files with 2091 additions and 1130 deletions
+1
View File
@@ -504,6 +504,7 @@
<inspection_tool class="MinMaxValuesInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MinitestFrameworkSupportInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MisorderedAssertEqualsParameters" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MissingDeprecatedAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreObjectMethods" value="true" />
<option name="ignoreAnonymousClassMethods" value="false" />
+11 -1
View File
@@ -1,12 +1,22 @@
<component name="libraryTable">
<library name="pty4j" type="repository">
<properties include-transitive-deps="false" maven-id="org.jetbrains.pty4j:pty4j:0.8.4" />
<properties maven-id="org.jetbrains.pty4j:pty4j:0.8.4">
<exclude>
<dependency maven-id="org.jetbrains:annotations" />
<dependency maven-id="com.google.guava:guava" />
<dependency maven-id="log4j:log4j" />
<dependency maven-id="net.java.dev.jna:jna" />
<dependency maven-id="net.java.dev.jna:jna-platform" />
</exclude>
</properties>
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/pty4j/0.8.4/pty4j-0.8.4.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/purejavacomm/0.0.11.1/purejavacomm-0.0.11.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/pty4j/0.8.4/pty4j-0.8.4-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/purejavacomm/0.0.11.1/purejavacomm-0.0.11.1-sources.jar!/" />
</SOURCES>
</library>
</component>
-12
View File
@@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="purejavacomm" type="repository">
<properties include-transitive-deps="false" maven-id="org.jetbrains.pty4j:purejavacomm:0.0.11.1" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/purejavacomm/0.0.11.1/purejavacomm-0.0.11.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/pty4j/purejavacomm/0.0.11.1/purejavacomm-0.0.11.1-sources.jar!/" />
</SOURCES>
</library>
</component>
+3 -3
View File
@@ -1,12 +1,12 @@
<component name="libraryTable">
<library name="sa-jdwp" type="repository">
<properties maven-id="org.jetbrains.intellij.deps:sa-jdwp:1.0.4" />
<properties maven-id="org.jetbrains.intellij.deps:sa-jdwp:1.0.5" />
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/sa-jdwp/1.0.4/sa-jdwp-1.0.4.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/sa-jdwp/1.0.5/sa-jdwp-1.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/sa-jdwp/1.0.4/sa-jdwp-1.0.4-sources.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/intellij/deps/sa-jdwp/1.0.5/sa-jdwp-1.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>
File diff suppressed because it is too large Load Diff
@@ -52,6 +52,11 @@ public enum RegExpCapability {
OMIT_BOTH_NUMBERS_IN_QUANTIFIERS,
COMMENT_MODE,
/**
* In comment mode, spaces, tabs, etc in a class are also whitespace. Comments also work inside classes (Java).
*/
WHITESPACE_IN_CLASS,
/**
* '\h'
*/
@@ -65,8 +65,9 @@ public class RegExpCharImpl extends RegExpElementImpl implements RegExpChar {
assert length > 0;
boolean escaped = false;
for (int idx = 0; idx < length; idx++) {
final char ch = s.charAt(idx);
int idx = 0;
while (idx < length) {
final int ch = s.codePointAt(idx);
if (!escaped) {
if (ch == '\\') {
escaped = true;
@@ -133,6 +134,7 @@ public class RegExpCharImpl extends RegExpElementImpl implements RegExpChar {
return ch;
}
}
idx = Character.charCount(ch);
}
return -1;
@@ -44,6 +44,7 @@ import static org.intellij.lang.regexp.RegExpCapability.*;
private boolean allowMysqlBracketExpressions;
private int maxOctal = 0777;
private int minOctalDigits = 1;
private boolean whitespaceInClass;
_RegExLexer(EnumSet<RegExpCapability> capabilities) {
this((java.io.Reader)null);
@@ -75,6 +76,7 @@ import static org.intellij.lang.regexp.RegExpCapability.*;
}
this.allowExtendedUnicodeCharacter = capabilities.contains(EXTENDED_UNICODE_CHARACTER);
this.allowOneHexCharEscape = capabilities.contains(ONE_HEX_CHAR_ESCAPE);
this.whitespaceInClass = capabilities.contains(WHITESPACE_IN_CLASS);
}
private void yypushstate(int state) {
@@ -253,7 +255,6 @@ HEX_CHAR=[0-9a-fA-F]
{ESCAPE} [hH] { return (allowHexDigitClass || allowHorizontalWhitespaceClass ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN); }
{ESCAPE} "N" { yypushstate(NAMED); return RegExpTT.NAMED_CHARACTER; }
{ESCAPE} {TRANSFORMATION} { return allowTransformationEscapes ? RegExpTT.CHAR_CLASS : StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
{ESCAPE} [\n\b\t\r\f ] { return commentMode ? RegExpTT.ESC_CTRL_CHARACTER : RegExpTT.REDUNDANT_ESCAPE; }
<CLASS2> {
{ESCAPE} {RBRACKET} { return RegExpTT.ESC_CHARACTER; }
@@ -261,19 +262,15 @@ HEX_CHAR=[0-9a-fA-F]
}
<YYINITIAL> {
{ESCAPE} [\n\b\t\r\f ] { return commentMode ? RegExpTT.ESC_CTRL_CHARACTER : RegExpTT.REDUNDANT_ESCAPE; }
{ESCAPE} "k<" { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_REF; }
{ESCAPE} "k'" { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_REF; }
{ESCAPE} "g<" { yybegin(NAMED_GROUP); return RegExpTT.RUBY_NAMED_GROUP_CALL; }
{ESCAPE} "g'" { yybegin(QUOTED_NAMED_GROUP); return RegExpTT.RUBY_QUOTED_NAMED_GROUP_CALL; }
{ESCAPE} "R" { return RegExpTT.CHAR_CLASS; }
{ESCAPE} {BOUNDARY} { return RegExpTT.BOUNDARY; }
{ESCAPE} {BOUNDARY} { return RegExpTT.BOUNDARY; }
}
{ESCAPE} [A-Za-z] { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
{ESCAPE} {ANY} { return RegExpTT.REDUNDANT_ESCAPE; }
{ESCAPE} { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
<PROP> {
{LBRACE} { yypopstate(); yypushstate(EMBRACED); return RegExpTT.LBRACE; }
"L"|"M"|"Z"|"S"|"N"|"P"|"C" { yypopstate(); return RegExpTT.CATEGORY_SHORT_HAND; }
@@ -332,7 +329,7 @@ HEX_CHAR=[0-9a-fA-F]
{LBRACKET} / [.=] { yybegin(CLASS2); if (allowMysqlBracketExpressions) { yypushback(1); } else if (allowNestedCharacterClasses) { yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } else { return RegExpTT.CHARACTER; } }
{LBRACKET} / "^" { yybegin(CLASS2); if (allowNestedCharacterClasses) { yypushstate(NEGATED_CLASS); return RegExpTT.CLASS_BEGIN; } return RegExpTT.CHARACTER; }
{LBRACKET} { yybegin(CLASS2); if (allowNestedCharacterClasses) { yypushstate(CLASS1); return RegExpTT.CLASS_BEGIN; } return RegExpTT.CHARACTER; }
[\n\b\t\r\f ] { if (commentMode) return com.intellij.psi.TokenType.WHITE_SPACE; yypushback(1); yybegin(CLASS2); }
[\n\b\t\r\f ] { if (commentMode && whitespaceInClass) return com.intellij.psi.TokenType.WHITE_SPACE; yypushback(1); yybegin(CLASS2); }
{ANY} { yypushback(1); yybegin(CLASS2); }
}
@@ -357,11 +354,17 @@ HEX_CHAR=[0-9a-fA-F]
{RBRACKET} { yypopstate(); return RegExpTT.CLASS_END; }
"&&" { if (allowNestedCharacterClasses) return RegExpTT.ANDAND; else yypushback(1); return RegExpTT.CHARACTER; }
"-" { return RegExpTT.MINUS; }
" " { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; }
[\n\b\t\r\f] { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CTRL_CHARACTER; }
{ANY} { return RegExpTT.CHARACTER; }
" " { return (commentMode && whitespaceInClass) ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; }
[\n\b\t\r\f] { return (commentMode && whitespaceInClass) ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CTRL_CHARACTER; }
"#" { if (commentMode && whitespaceInClass) yypushstate(COMMENT); else return RegExpTT.CHARACTER; }
"^" { return RegExpTT.CHARACTER; }
{ESCAPE}[\n\b\t\r\f ] { return (commentMode && whitespaceInClass) ? RegExpTT.ESC_CTRL_CHARACTER : RegExpTT.REDUNDANT_ESCAPE; }
}
{ESCAPE} [A-Za-z] { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
{ESCAPE} {ANY} { return RegExpTT.REDUNDANT_ESCAPE; }
{ESCAPE} { return StringEscapesTokenTypes.INVALID_CHARACTER_ESCAPE_TOKEN; }
<BRACKET_EXPRESSION> {
"^" { return RegExpTT.CARET; }
{NAME} { return RegExpTT.NAME; }
@@ -455,9 +458,9 @@ HEX_CHAR=[0-9a-fA-F]
<YYINITIAL> {RBRACKET} { return allowDanglingMetacharacters == Boolean.FALSE ? RegExpTT.CLASS_END : RegExpTT.CHARACTER; }
"#" { if (commentMode) { yypushstate(COMMENT); return RegExpTT.COMMENT; } else return RegExpTT.CHARACTER; }
"#" { if (commentMode) { yypushstate(COMMENT); } else return RegExpTT.CHARACTER; }
<COMMENT> {
[^\r\n]*[\r\n]? { yypopstate(); return RegExpTT.COMMENT; }
[^\r\n]* { yypopstate(); return RegExpTT.COMMENT; }
}
" " { return commentMode ? com.intellij.psi.TokenType.WHITE_SPACE : RegExpTT.CHARACTER; }
@@ -411,7 +411,7 @@ public class RegExpLexerTest extends LexerTestCase {
"QUOTE_END ('\\E')\n" +
"CLASS_END (']')\n" +
"CHARACTER (']')", lexer);
final RegExpLexer lexer2 = new RegExpLexer(EnumSet.of(COMMENT_MODE));
final RegExpLexer lexer2 = new RegExpLexer(EnumSet.of(COMMENT_MODE, WHITESPACE_IN_CLASS));
doTest("[ \t\n]]", "CLASS_BEGIN ('[')\n" +
"WHITE_SPACE (' ')\n" +
"WHITE_SPACE ('\t')\n" +
@@ -421,6 +421,20 @@ public class RegExpLexerTest extends LexerTestCase {
doTest("[\\ ]", "CLASS_BEGIN ('[')\n" +
"ESC_CTRL_CHARACTER ('\\ ')\n" +
"CLASS_END (']')", lexer2);
doTest("[#comment\nabc]", "CLASS_BEGIN ('[')\n" +
"COMMENT ('#comment')\n" +
"WHITE_SPACE ('\\n')\n" +
"CHARACTER ('a')\n" +
"CHARACTER ('b')\n" +
"CHARACTER ('c')\n" +
"CLASS_END (']')", lexer2);
doTest("[ ^]]", "CLASS_BEGIN ('[')\n" +
"WHITE_SPACE (' ')\n" +
"CHARACTER ('^')\n" +
"CLASS_END (']')\n" +
"CHARACTER (']')", lexer2);
doTest("[\\", "CLASS_BEGIN ('[')\n" +
"INVALID_CHARACTER_ESCAPE_TOKEN ('\\')", lexer2);
final RegExpLexer lexer3 = new RegExpLexer(EnumSet.of(ALLOW_EMPTY_CHARACTER_CLASS));
doTest("[]]", "CLASS_BEGIN ('[')\n" +
"CLASS_END (']')\n" +
@@ -437,6 +451,16 @@ public class RegExpLexerTest extends LexerTestCase {
"CHARACTER (' ')\n" +
"ESC_CHARACTER ('\\]')\n" +
"CLASS_END (']')", lexer3);
final RegExpLexer lexer4 = new RegExpLexer(EnumSet.of(COMMENT_MODE));
doTest("[ ]", "CLASS_BEGIN ('[')\n" +
"CHARACTER (' ')\n" +
"CLASS_END (']')", lexer4);
doTest("[#]", "CLASS_BEGIN ('[')\n" +
"CHARACTER ('#')\n" +
"CLASS_END (']')", lexer4);
doTest("[\\ ]", "CLASS_BEGIN ('[')\n" +
"REDUNDANT_ESCAPE ('\\ ')\n" +
"CLASS_END (']')", lexer4);
}
public void testBoundaries() {
+4 -4
View File
@@ -17,10 +17,10 @@ REGEXP_FILE
RegExpCharImpl: <c>
PsiElement(CHARACTER)('c')
PsiWhiteSpace(' ')
PsiComment(COMMENT)('#')
PsiComment(COMMENT)('foo \q bar\n')
PsiComment(COMMENT)('#')
PsiComment(COMMENT)(' foo\n')
PsiComment(COMMENT)('#foo \q bar')
PsiWhiteSpace('\n')
PsiComment(COMMENT)('# foo')
PsiWhiteSpace('\n')
RegExpSetOptionsImpl: <(?-xi)>
PsiElement(SET_OPTIONS)('(?')
RegExpOptionsImpl: <-xi>
+73
View File
@@ -0,0 +1,73 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="70" height="70" viewBox="0 0 70 70">
<defs>
<linearGradient id="linear-gradient" x1="6" y1="35" x2="64" y2="35" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fe315d"/>
<stop offset="0.0784" stop-color="#cb417e"/>
<stop offset="0.16008" stop-color="#9e4e9b"/>
<stop offset="0.24742" stop-color="#755bb4"/>
<stop offset="0.33917" stop-color="#5365ca"/>
<stop offset="0.43648" stop-color="#386ddb"/>
<stop offset="0.54144" stop-color="#2374e9"/>
<stop offset="0.65763" stop-color="#1478f3"/>
<stop offset="0.794" stop-color="#0b7bf8"/>
<stop offset="1" stop-color="#087cfa"/>
</linearGradient>
<clipPath id="clip-path">
<rect x="6" y="6" width="58" height="58" fill="none"/>
</clipPath>
<linearGradient id="linear-gradient-2" x1="12.58059" y1="25.54097" x2="24.98059" y2="67.54097" gradientUnits="userSpaceOnUse">
<stop offset="0.25806" stop-color="#f97a12"/>
<stop offset="0.45911" stop-color="#b07b58"/>
<stop offset="0.7241" stop-color="#577bae"/>
<stop offset="0.91053" stop-color="#1e7ce5"/>
<stop offset="1" stop-color="#087cfa"/>
</linearGradient>
<linearGradient id="linear-gradient-3" x1="21.83803" y1="29.05557" x2="73.70019" y2="57.75263" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#f97a12"/>
<stop offset="0.0718" stop-color="#cb7a3e"/>
<stop offset="0.15406" stop-color="#9e7b6a"/>
<stop offset="0.24204" stop-color="#757b91"/>
<stop offset="0.33443" stop-color="#537bb1"/>
<stop offset="0.43243" stop-color="#387ccc"/>
<stop offset="0.53813" stop-color="#237ce0"/>
<stop offset="0.65516" stop-color="#147cef"/>
<stop offset="0.79251" stop-color="#0b7cf7"/>
<stop offset="1" stop-color="#087cfa"/>
</linearGradient>
<linearGradient id="linear-gradient-4" x1="61.16399" y1="43.28504" x2="47.46406" y2="2.34834" xlink:href="#linear-gradient"/>
<linearGradient id="linear-gradient-5" x1="13.13666" y1="18.03792" x2="56.68467" y2="90.06868" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#fe315d"/>
<stop offset="0.04023" stop-color="#f63462"/>
<stop offset="0.10373" stop-color="#df3a71"/>
<stop offset="0.16667" stop-color="#c24383"/>
<stop offset="0.29121" stop-color="#ad4a91"/>
<stop offset="0.5498" stop-color="#755bb4"/>
<stop offset="0.91755" stop-color="#1d76ed"/>
<stop offset="1" stop-color="#087cfa"/>
</linearGradient>
</defs>
<title>IntelliJIDEAComEAP</title>
<rect x="6" y="6" width="58" height="58" fill="url(#linear-gradient)"/>
<g clip-path="url(#clip-path)">
<g>
<polygon points="6 64 7.378 64 17.688 54.582 33.317 35.03 6 26.893 6 64" fill="url(#linear-gradient-2)"/>
<polygon points="64 61.103 64 13.806 54.355 6 44.124 6 38.9 12.26 49.251 34.964 9 63 13.682 64 56.764 64 64 61.103" fill="url(#linear-gradient-3)"/>
<polygon points="64 13.806 54.355 6 44.124 6 38.9 12.26 48.672 43.912 64 25.766 64 13.806" fill="url(#linear-gradient-4)"/>
<polygon points="6 29.737 15.955 33.065 6 60.49 6 64 11.556 64 38 57 53.706 27.375 34.995 6 6 6 6 29.737" fill="url(#linear-gradient-5)"/>
</g>
</g>
<g>
<rect x="14" y="14" width="42" height="42"/>
<rect x="17.98999" y="48.125" width="15.75" height="2.625" fill="#fff"/>
</g>
<polygon points="29.269 22.649 29.269 19.461 20.573 19.461 20.573 22.649 23.008 22.649 23.008 33.663 20.573 33.663 20.573 36.852 29.269 36.852 29.269 33.663 26.834 33.663 26.834 22.649 29.269 22.649" fill="#fff"/>
<path d="M37.61656,37.10026a6.92231,6.92231,0,0,1-3.41622-.77021,8.019,8.019,0,0,1-2.27317-1.83831l2.41015-2.68347a6.88845,6.88845,0,0,0,1.503,1.27938,3.16575,3.16575,0,0,0,1.67677.46006,2.19777,2.19777,0,0,0,1.71424-.68364,3.2133,3.2133,0,0,0,.62161-2.19885v-11.205h3.92538V30.839a7.814,7.814,0,0,1-.42259,2.70867,5.29435,5.29435,0,0,1-1.21736,1.93781,5.15053,5.15053,0,0,1-1.95008,1.20509,7.66587,7.66587,0,0,1-2.57169.40965" fill="#fff"/>
<g>
<rect x="37" y="53" width="33" height="17" fill="#d99e2b"/>
<g>
<path d="M40.05563,66.966h7.19661V65.24271H41.745V62.2975h4.82041V60.57425H41.745V57.72294h5.43874V55.99969H40.05563Z"/>
<path d="M48.15627,66.966h1.86832l1.06757-2.6268h4.9082l1.05281,2.6268h1.9277l-4.5671-10.95841h-1.6904Zm3.60316-4.321,1.77945-4.35241L55.33309,62.645Z"/>
<path d="M59.87536,66.966h1.62869V63.44109h1.84026a3.50285,3.50285,0,0,0,3.70715-3.74426v-.03124a3.36233,3.36233,0,0,0-3.52185-3.6659H59.87536Zm1.62869-5.26364V57.75418h1.89333a1.80658,1.80658,0,0,1,1.99894,1.95836V59.744a1.86938,1.86938,0,0,1-1.99894,1.95836Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

@@ -7,6 +7,7 @@
<logo url="/idea_community_logo.png" textcolor="ffffff" progressColor="ffffff" progressX="117" progressY="280" progressHeight="3" />
<about url="/idea_community_about.png" foreground="939598" copyrightForeground="939598" linkColor="095fdc" logoX="540" logoY="300" logoW="100" logoH="100"/>
<icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size128="/icon_CE_128.png" ico="idea_CE.ico" svg="/idea-ce.svg"/>
<icon-eap svg="/idea-ce-eap.svg"/>
<package code="__PACKAGE_CODE__"/>
<names product="IDEA" fullname="IntelliJ IDEA" edition="Community Edition" script="idea" motto="Capable and Ergonomic IDE for JVM"/>
@@ -1314,7 +1314,7 @@ public class BuildManager implements Disposable {
}
@NotNull
private File getBuildLogDirectory() {
public static File getBuildLogDirectory() {
return new File(PathManager.getLogPath(), "build-log");
}
@@ -23,10 +23,7 @@ import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.VfsTestUtil;
import com.intellij.testFramework.*;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.io.TestFileSystemBuilder;
import com.intellij.util.ui.UIUtil;
@@ -250,20 +247,31 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
};
PlatformTestUtil.saveProject(myProject);
CompilerTestUtil.saveApplicationSettings();
try {
CompilerTester.enableDebugLogging();
}
catch (IOException e) {
throw new RuntimeException(e);
}
action.accept(callback);
});
final long start = System.currentTimeMillis();
while (!semaphore.waitFor(10)) {
if (System.currentTimeMillis() - start > 5 * 60 * 1000) {
throw new RuntimeException("timeout");
try {
final long start = System.currentTimeMillis();
while (!semaphore.waitFor(10)) {
if (System.currentTimeMillis() - start > 50 * 60 * 1000) {
throw new RuntimeException("timeout");
}
if (SwingUtilities.isEventDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
}
}
if (SwingUtilities.isEventDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
}
}
if (SwingUtilities.isEventDispatchThread()) {
UIUtil.dispatchAllInvocationEvents();
finally {
CompilerTester.printBuildLog();
}
return result.get();
@@ -38,7 +38,7 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author Jeka
* @deprecated use {@link BaseCompilerTestCase} instead
*/
public abstract class CompilerTestCase extends ModuleTestCase {
private static final int COMPILING_TIMEOUT = 2 * 60 * 1000;
@@ -452,7 +452,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
final String address = myConnection.getAddress();
if (myConnection instanceof PidRemoteConnection) {
if (myConnection instanceof PidRemoteConnection && !((PidRemoteConnection)myConnection).isFixedAddress()) {
PidRemoteConnection pidRemoteConnection = (PidRemoteConnection)myConnection;
Connector connector = pidRemoteConnection.getConnector(this);
String pid = pidRemoteConnection.getPid();
@@ -3,6 +3,7 @@ package com.intellij.debugger.impl.attach;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.engine.RemoteStateState;
import com.intellij.debugger.impl.DebuggerManagerImpl;
import com.intellij.debugger.impl.GenericDebuggerRunner;
import com.intellij.execution.*;
import com.intellij.execution.configurations.*;
@@ -57,7 +58,7 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
@NotNull
@Override
public String getDebuggerDisplayName() {
return "Java Debugger";
return myInfo.getDebuggerName();
}
@Override
@@ -68,16 +69,26 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
private static final Key<Map<String, LocalAttachInfo>> ADDRESS_MAP_KEY = Key.create("ADDRESS_MAP");
private static final XLocalAttachGroup ourAttachGroup = new XDefaultLocalAttachGroup() {
private static final XLocalAttachGroup ourAttachGroup = new JavaDebuggerAttachGroup("Java", -20);
static class JavaDebuggerAttachGroup extends XDefaultLocalAttachGroup {
private final String myName;
private final int myOrder;
JavaDebuggerAttachGroup(String name, int order) {
myName = name;
myOrder = order;
}
@Override
public int getOrder() {
return 1;
return myOrder;
}
@NotNull
@Override
public String getGroupName() {
return "Java";
return myName;
}
@NotNull
@@ -129,7 +140,14 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
}
LocalAttachInfo info = getAttachInfo(project, processInfo, addressMap);
return info != null ? Collections.singletonList(new JavaLocalAttachDebugger(project, info)) : Collections.emptyList();
if (info != null && isDebuggerAttach(info)) {
return Collections.singletonList(new JavaLocalAttachDebugger(project, info));
}
return Collections.emptyList();
}
boolean isDebuggerAttach(LocalAttachInfo info) {
return info instanceof DebuggerLocalAttachInfo;
}
private static Set<String> getAttachedPids(@NotNull Project project) {
@@ -172,7 +190,7 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
if (param.startsWith("address")) {
try {
address = param.split("=")[1];
return new DebuggerLocalAttachInfo(socket, address, null, pid);
return new DebuggerLocalAttachInfo(socket, address, null, pid, false);
}
catch (Exception e) {
LOG.error(e);
@@ -222,14 +240,23 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
String command = agentProperties.getProperty("sun.java.command");
if (!StringUtil.isEmpty(command)) {
command = StringUtil.replace(command, AppMainV2.class.getName(), "").trim();
command = StringUtil.substringBefore(command, " ");
command = StringUtil.notNullize(StringUtil.substringBefore(command, " "), command);
}
String property = agentProperties.getProperty("sun.jdwp.listenerAddress");
if (property != null && property.indexOf(':') != -1) {
boolean autoAddress = false;
String args = agentProperties.getProperty("sun.jvm.args");
if (!StringUtil.isEmpty(args)) {
for (String arg : args.split(" ")) {
if (arg.startsWith("-agentlib:jdwp")) {
autoAddress = !arg.contains("address=");
break;
}
}
}
return new DebuggerLocalAttachInfo(!"dt_shmem".equals(StringUtil.substringBefore(property, ":")),
StringUtil.substringAfter(property, ":"),
command,
pid);
command, pid, autoAddress);
}
//do not allow further for idea process
@@ -267,18 +294,32 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
}
private static class DebuggerLocalAttachInfo extends LocalAttachInfo {
final boolean myUseSocket;
final String myAddress;
private final boolean myUseSocket;
private final String myAddress;
private final boolean myAutoAddress;
DebuggerLocalAttachInfo(boolean socket, @NotNull String address, String aClass, String pid) {
DebuggerLocalAttachInfo(boolean socket, @NotNull String address, String aClass, String pid, boolean autoAddress) {
super(aClass, pid);
myUseSocket = socket;
myAddress = address;
myAutoAddress = autoAddress;
}
@Override
RemoteConnection createConnection() {
return new PidRemoteConnection(myPid);
return myAutoAddress
? new PidRemoteConnection(myPid)
: new PidRemoteConnection(myPid, myUseSocket, DebuggerManagerImpl.LOCALHOST_ADDRESS_FALLBACK, myAddress, false);
}
@Override
String getSessionName() {
return myAutoAddress ? super.getSessionName() : "localhost:" + myAddress;
}
@Override
String getDebuggerName() {
return "Java Debugger";
}
@Override
@@ -318,8 +359,12 @@ public class JavaAttachDebuggerProvider implements XLocalAttachDebuggerProvider
return "pid " + myPid;
}
String getDebuggerName() {
return "Read Only Java Debugger";
}
String getProcessDisplayText(String text) {
return text + " (read only)";
return text;
}
}
@@ -0,0 +1,23 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.debugger.impl.attach;
import com.intellij.xdebugger.attach.XLocalAttachGroup;
import org.jetbrains.annotations.NotNull;
/**
* @author egor
*/
public class JavaSAAttachDebuggerProvider extends JavaAttachDebuggerProvider {
private static final XLocalAttachGroup ourAttachGroup = new JavaDebuggerAttachGroup("Java Read Only", -19);
@NotNull
@Override
public XLocalAttachGroup getAttachGroup() {
return ourAttachGroup;
}
@Override
boolean isDebuggerAttach(LocalAttachInfo info) {
return !super.isDebuggerAttach(info);
}
}
@@ -11,13 +11,17 @@ import com.sun.jdi.connect.Connector;
*/
public class PidRemoteConnection extends RemoteConnection {
private final String myPid;
private final boolean myFixedAddress;
public PidRemoteConnection(String pid) {
this(pid, false);
super(false, null, null, false);
myFixedAddress = false;
myPid = pid;
}
PidRemoteConnection(String pid, boolean serverMode) {
super(false, null, null, serverMode);
public PidRemoteConnection(String pid, boolean useSockets, String hostName, String address, boolean serverMode) {
super(useSockets, hostName, address, serverMode);
myFixedAddress = true;
myPid = pid;
}
@@ -26,6 +30,11 @@ public class PidRemoteConnection extends RemoteConnection {
}
public Connector getConnector(DebugProcessImpl debugProcess) throws ExecutionException {
assert !myFixedAddress;
return DebugProcessImpl.findConnector("com.sun.jdi.ProcessAttach");
}
public boolean isFixedAddress() {
return myFixedAddress;
}
}
@@ -29,7 +29,8 @@ public class SAJDWPRemoteConnection extends PidRemoteConnection {
private static final Logger LOG = Logger.getInstance(SAJDWPRemoteConnection.class);
public SAJDWPRemoteConnection(String pid) {
super(pid, true);
super(pid);
setServerMode(true);
setAddress("0");
}
@@ -307,8 +307,8 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
}
@Override
public void setState(@NotNull BaseState state) {
super.setState(state);
public void setOptionsFromConfigurationFile(@NotNull BaseState state) {
super.setOptionsFromConfigurationFile(state);
syncOldStateFields();
}
@@ -148,13 +148,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
@Override
public boolean visitQualifiedReferenceExpression(@NotNull UQualifiedReferenceExpression node) {
visitReferenceExpression(node);
node.getAnnotations().forEach(annotation -> annotation.accept(this));
UExpression receiver = node.getReceiver();
receiver.accept(this);
if (!(receiver instanceof UInstanceExpression)) {
node.getSelector().accept(this);
}
return true;
return false;
}
@Override
@@ -203,6 +197,10 @@ public class RefJavaUtilImpl extends RefJavaUtil {
}
private void visitReferenceExpression(UExpression node) {
UElement uastParent = node.getUastParent();
if (uastParent instanceof UQualifiedReferenceExpression && ((UQualifiedReferenceExpression)uastParent).getSelector() == node) {
return;
}
PsiElement psiResolved = null;
if (node instanceof UResolvable) {
psiResolved = ((UResolvable)node).resolve();
@@ -302,7 +300,7 @@ public class RefJavaUtilImpl extends RefJavaUtil {
final UDeclaration from,
boolean defaultConstructorOnly) {
if (psiClass != null) {
RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(psiClass.getNavigationElement());
RefClassImpl refClass = ObjectUtils.tryCast(refFrom.getRefManager().getReference(psiClass.getNavigationElement()), RefClassImpl.class);
if (refClass != null) {
boolean hasConstructorsMarked = false;
+5 -4
View File
@@ -907,6 +907,11 @@
groupKey="group.names.probable.bugs" groupBundle="messages.InspectionsBundle"
enabledByDefault="true" level="WARNING"
implementationClass="com.siyeh.ig.bugs.SortedCollectionWithNonComparableKeysInspection" />
<localInspection groupPath="Java" language="JAVA" shortName="JoinDeclarationAndAssignmentJava"
key="inspection.join.declaration.and.assignment.display.name" bundle="messages.InspectionsBundle"
groupKey="group.names.code.style.issues" groupBundle="messages.InspectionsBundle"
enabledByDefault="true" level="INFO"
implementationClass="com.intellij.codeInspection.JoinDeclarationAndAssignmentJavaInspection" />
<globalInspection groupPath="Java" language="JAVA" shortName="EmptyMethod" displayName="Empty method" groupKey="group.names.declaration.redundancy" enabledByDefault="true" groupBundle="messages.InspectionsBundle"
level="WARNING" implementationClass="com.intellij.codeInspection.emptyMethod.EmptyMethodInspection"/>
@@ -1045,10 +1050,6 @@
<className>com.intellij.codeInsight.intention.impl.MoveInitializerToConstructorAction</className>
<category>Java/Declaration</category>
</intentionAction>
<intentionAction>
<className>com.intellij.codeInsight.intention.impl.JoinDeclarationAndAssignmentAction</className>
<category>Java/Declaration</category>
</intentionAction>
<intentionAction>
<className>com.intellij.codeInsight.intention.impl.SplitDeclarationAction</className>
<category>Java/Declaration</category>
@@ -240,7 +240,7 @@ public class InlineStreamMapAction extends PsiElementBaseIntentionAction {
}
ct.replace(e, replacement);
}
ct.replace(nextParameters[0], prevParameters[0]);
ct.replace(lambda.getParameterList(), previousLambda.getParameterList());
ExpressionUtils.bindReferenceTo(nextRef, newName);
PsiExpression prevQualifier = mapCall.getMethodExpression().getQualifierExpression();
if(prevQualifier == null) {
@@ -1,129 +0,0 @@
/*
* Copyright 2000-2017 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.codeInsight.intention.impl;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.editorActions.DeclarationJoinLinesHandler;
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
import com.intellij.codeInspection.RemoveInitializerFix;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
public class JoinDeclarationAndAssignmentAction extends PsiElementBaseIntentionAction {
@Override
@NotNull
public String getFamilyName() {
return CodeInsightBundle.message("intention.join.declaration.family");
}
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
if (element instanceof PsiCompiledElement) return false;
if (!element.getManager().isInProject(element)) return false;
if (!element.getLanguage().isKindOf(JavaLanguage.INSTANCE)) return false;
if (getPair(element) != null) {
setText(CodeInsightBundle.message("intention.join.declaration.text"));
return true;
}
return false;
}
private static Pair<PsiLocalVariable, PsiAssignmentExpression> getPair(PsiElement element) {
PsiAssignmentExpression assignmentExpression = PsiTreeUtil.getParentOfType(element, PsiAssignmentExpression.class);
PsiDeclarationStatement declarationStatement = PsiTreeUtil.getParentOfType(element, PsiDeclarationStatement.class);
if (declarationStatement != null) {
assignmentExpression = getAssignmentStatement(declarationStatement);
} else if (assignmentExpression != null) {
declarationStatement = getDeclarationStatement(assignmentExpression);
}
if (declarationStatement != null && assignmentExpression != null) {
final PsiExpression lExpression = assignmentExpression.getLExpression();
final PsiExpression rExpression = assignmentExpression.getRExpression();
if (lExpression instanceof PsiReferenceExpression && rExpression != null) {
final PsiElement resolve = ((PsiReferenceExpression)lExpression).resolve();
if (resolve instanceof PsiLocalVariable && resolve.getParent() == declarationStatement) {
final PsiLocalVariable variable = (PsiLocalVariable)resolve;
if (ReferencesSearch.search(variable, new LocalSearchScope(rExpression), false).findFirst() != null) {
return null;
}
return Pair.createNonNull(variable, assignmentExpression);
}
}
}
return null;
}
private static PsiAssignmentExpression getAssignmentStatement(PsiDeclarationStatement statement) {
final PsiElement element = PsiTreeUtil.skipWhitespacesForward(statement);
if (element instanceof PsiExpressionStatement) {
final PsiExpression expression = ((PsiExpressionStatement)element).getExpression();
if (expression instanceof PsiAssignmentExpression) {
return (PsiAssignmentExpression)expression;
}
}
return null;
}
private static PsiDeclarationStatement getDeclarationStatement(PsiAssignmentExpression assignmentExpression) {
final PsiElement parent = assignmentExpression.getParent();
if (parent instanceof PsiExpressionStatement) {
final PsiElement element = PsiTreeUtil.skipWhitespacesBackward(parent);
if (element instanceof PsiDeclarationStatement) {
return (PsiDeclarationStatement)element;
}
}
return null;
}
@Override
public boolean startInWriteAction() {
return false;
}
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
if (!FileModificationService.getInstance().preparePsiElementForWrite(element)) return;
final Pair<PsiLocalVariable, PsiAssignmentExpression> pair = getPair(element);
if (pair == null) return;
final PsiLocalVariable variable = pair.getFirst();
final PsiAssignmentExpression assignmentExpression = pair.getSecond();
final PsiExpression initializer = variable.getInitializer();
if (initializer != null && assignmentExpression.getOperationTokenType() == JavaTokenType.EQ) {
RemoveInitializerFix.sideEffectAwareRemove(project, initializer, initializer, variable);
}
WriteAction.run(() -> {
final PsiExpression initializerExpression = DeclarationJoinLinesHandler.getInitializerExpression(variable, assignmentExpression);
if (initializerExpression != null) {
variable.setInitializer(initializerExpression);
assignmentExpression.delete();
}
});
}
}
@@ -0,0 +1,136 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.editorActions.DeclarationJoinLinesHandler;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ObjectUtils;
import com.siyeh.ig.psiutils.CommentTracker;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* It's called "Java" inspection because the name without "Java" already exists.
*
* @author Pavel.Dolgov
*/
public class JoinDeclarationAndAssignmentJavaInspection extends AbstractBaseJavaLocalInspectionTool {
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
@Override
public void visitAssignmentExpression(PsiAssignmentExpression assignmentExpression) {
super.visitAssignmentExpression(assignmentExpression);
final Pair.NonNull<PsiLocalVariable, PsiAssignmentExpression> pair = getPair(assignmentExpression);
if (pair != null) {
String name = pair.getFirst().getName();
if (name != null) {
String message = InspectionsBundle.message("inspection.join.declaration.and.assignment.message", name);
JoinDeclarationAndAssignmentFix fix = new JoinDeclarationAndAssignmentFix();
holder.registerProblem(pair.getFirst(), message, fix);
holder.registerProblem(pair.getSecond(), message, fix);
}
}
}
};
}
@Nullable
private static Pair.NonNull<PsiLocalVariable, PsiAssignmentExpression> getPair(@Nullable PsiElement element) {
PsiLocalVariable variable = null;
PsiAssignmentExpression assignmentExpression = null;
if (element instanceof PsiAssignmentExpression) {
assignmentExpression = (PsiAssignmentExpression)element;
variable = findVariable(assignmentExpression);
}
else if (element instanceof PsiLocalVariable) {
variable = (PsiLocalVariable)element;
assignmentExpression = findAssignment(variable);
}
if (variable != null && assignmentExpression != null) {
PsiExpression rExpression = assignmentExpression.getRExpression();
if (rExpression != null &&
ReferencesSearch.search(variable, new LocalSearchScope(rExpression), false).findFirst() == null) {
return Pair.createNonNull(variable, assignmentExpression);
}
}
return null;
}
@Nullable
private static PsiLocalVariable findVariable(@NotNull PsiAssignmentExpression assignmentExpression) {
PsiElement assignmentParent = assignmentExpression.getParent();
if (assignmentParent instanceof PsiExpressionStatement) {
PsiElement candidate = PsiTreeUtil.skipWhitespacesAndCommentsBackward(assignmentParent);
if (candidate instanceof PsiDeclarationStatement) {
PsiExpression lExpression = assignmentExpression.getLExpression();
if (lExpression instanceof PsiReferenceExpression) {
PsiElement resolved = ((PsiReferenceExpression)lExpression).resolve();
if (resolved instanceof PsiLocalVariable && resolved.getParent() == candidate) {
return (PsiLocalVariable)resolved;
}
}
}
}
return null;
}
@Nullable
private static PsiAssignmentExpression findAssignment(@NotNull PsiVariable variable) {
PsiDeclarationStatement statement = ObjectUtils.tryCast(variable.getParent(), PsiDeclarationStatement.class);
PsiElement candidate = PsiTreeUtil.skipWhitespacesAndCommentsForward(statement);
if (candidate instanceof PsiExpressionStatement) {
PsiExpression expression = ((PsiExpressionStatement)candidate).getExpression();
if (expression instanceof PsiAssignmentExpression) {
return (PsiAssignmentExpression)expression;
}
}
return null;
}
private static class JoinDeclarationAndAssignmentFix implements LocalQuickFix {
@Nls(capitalization = Nls.Capitalization.Sentence)
@NotNull
@Override
public String getFamilyName() {
return InspectionsBundle.message("inspection.join.declaration.and.assignment.fix.family.name");
}
@Override
public boolean startInWriteAction() {
return false;
}
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
Pair.NonNull<PsiLocalVariable, PsiAssignmentExpression> pair = getPair(descriptor.getPsiElement());
if (pair != null) {
PsiLocalVariable variable = pair.getFirst();
PsiAssignmentExpression assignmentExpression = pair.getSecond();
PsiExpression initializer = variable.getInitializer();
if (initializer != null && assignmentExpression.getOperationTokenType() == JavaTokenType.EQ) {
RemoveInitializerFix.sideEffectAwareRemove(project, initializer, initializer, variable);
}
if (!FileModificationService.getInstance().prepareFileForWrite(assignmentExpression.getContainingFile())) return;
WriteAction.run(() -> {
PsiExpression initializerExpression = DeclarationJoinLinesHandler.getInitializerExpression(variable, assignmentExpression);
if (initializerExpression != null) {
variable.setInitializer(initializerExpression);
new CommentTracker().deleteAndRestoreComments(assignmentExpression);
}
});
}
}
}
}
@@ -91,6 +91,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
}
/** @deprecated use {@link #MoveClassesOrPackagesDialog(Project, boolean, PsiElement[], PsiElement, MoveCallback, String, PsiDirectory, boolean, boolean)} */
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2019.1")
@SuppressWarnings("DeprecatedIsStillUsed")
public MoveClassesOrPackagesDialog(Project project,
@@ -145,6 +146,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
}
/** @deprecated use {@link #MoveClassesOrPackagesDialog(Project, boolean, PsiElement[], PsiElement, MoveCallback, String, PsiDirectory, boolean, boolean)} */
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2019.1")
@SuppressWarnings("DeprecatedIsStillUsed")
public void setData(PsiElement[] elementsToMove,
@@ -0,0 +1,5 @@
<html>
<body>
Reports variable assignments that can be joined with the variable's declaration.
</body>
</html>
@@ -1,5 +0,0 @@
public class X {
void f() {
int i = 0;
}
}
@@ -1,6 +0,0 @@
public class X {
void f() {
<spot>int i;
i = 0;</spot>
}
}
@@ -1,5 +0,0 @@
<html>
<body>
This intention converts a local variable declaration and consequence assignment to the same variable into one declaration
</body>
</html>
@@ -0,0 +1,8 @@
// "Inline 'map' body into the next 'forEach' call" "true"
import java.util.List;
public class Main {
public static void test(List<String> list) {
list.stream().forEach((String s) -> System.out.println(s.trim()));
}
}
@@ -0,0 +1,8 @@
// "Inline 'map' body into the next 'forEach' call" "true"
import java.util.List;
public class Main {
public static void test(List<String> list) {
list.stream().forEach(s -> System.out.println(s.trim()));
}
}
@@ -0,0 +1,8 @@
// "Inline 'map' body into the next 'forEach' call" "true"
import java.util.List;
public class Main {
public static void test(List<String> list) {
list.stream().ma<caret>p((String s) -> s.trim()).forEach(x -> System.out.println(x));
}
}
@@ -0,0 +1,8 @@
// "Inline 'map' body into the next 'forEach' call" "true"
import java.util.List;
public class Main {
public static void test(List<String> list) {
list.stream().ma<caret>p(s -> s.trim()).forEach((String x) -> System.out.println(x));
}
}
@@ -0,0 +1,8 @@
// "Join declaration and assignment" "true"
class Test {
{
String ss = "hello"; // comment A
// comment B
/*comment C*/ /*comment D*/ // comment E
}
}
@@ -0,0 +1,8 @@
// "Join declaration and assignment" "true"
class Test {
{
String s<caret>s = ""; // comment A
// comment B
/*comment C*/ ss /*comment D*/ = "hello"; // comment E
}
}
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -0,0 +1,17 @@
class A {
void m(String string) {
}
}
class B extends A {
void m(String string) {
super.m(string + "///");
}
}
public class Test {
public static void main(String[] args) {
new B().m("abc");
}
}
@@ -0,0 +1,24 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.daemon.quickFix;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
import com.intellij.codeInspection.JoinDeclarationAndAssignmentJavaInspection;
import com.intellij.codeInspection.LocalInspectionTool;
import org.jetbrains.annotations.NotNull;
/**
* @author Pavel.Dolgov
*/
public class JoinDeclarationAndAssignmentTest extends LightQuickFixParameterizedTestCase {
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{new JoinDeclarationAndAssignmentJavaInspection()};
}
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration";
}
}
@@ -1,26 +0,0 @@
/*
* Copyright 2000-2017 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.java.codeInsight.intention;
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
public class JoinDeclarationTest extends LightQuickFixParameterizedTestCase {
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/joinDeclaration";
}
}
@@ -238,4 +238,8 @@ public class UnusedDeclarationTest extends AbstractUnusedDeclarationTest {
public void testTypeParameterUsed() {
doTest();
}
public void testMethodCallQualifiedWithSuper() {
doTest();
}
}
@@ -1817,6 +1817,9 @@
<val name="pure" val="true"/>
</annotation>
</item>
<item name='java.util.Properties void store(java.io.OutputStream, java.lang.String) 1'>
<annotation name='org.jetbrains.annotations.Nullable'/>
</item>
<item name='java.util.Queue E element()'>
<annotation name='org.jetbrains.annotations.Contract'>
<val name="pure" val="true"/>
@@ -39,7 +39,7 @@ import java.util.stream.Stream;
import static com.intellij.openapi.util.Pair.pair;
/**
* NB: external annotations are not considered.
* NB: Supposed to be used for annotations used in libraries and frameworks only, external annotations are not considered.
*
* @since 2016.3
*/
@@ -80,7 +80,8 @@ public class MetaAnnotationUtil {
}
public static Set<PsiClass> getChildren(@NotNull PsiClass psiClass, @NotNull GlobalSearchScope scope) {
if (AnnotationTargetUtil.findAnnotationTarget(psiClass, PsiAnnotation.TargetType.ANNOTATION_TYPE, PsiAnnotation.TargetType.TYPE) == null) {
if (AnnotationTargetUtil.findAnnotationTarget(psiClass, PsiAnnotation.TargetType.ANNOTATION_TYPE, PsiAnnotation.TargetType.TYPE) ==
null) {
return Collections.emptySet();
}
@@ -128,7 +129,8 @@ public class MetaAnnotationUtil {
return CachedValuesManager.getManager(project).getCachedValue(project, () -> {
GlobalSearchScope scope = GlobalSearchScope.allScope(project);
Set<VirtualFile> allAnnotationFiles = new HashSet<>();
for (PsiClass javaLangAnnotation : JavaPsiFacade.getInstance(project).findClasses(CommonClassNames.JAVA_LANG_ANNOTATION_ANNOTATION, scope)) {
for (PsiClass javaLangAnnotation : JavaPsiFacade.getInstance(project)
.findClasses(CommonClassNames.JAVA_LANG_ANNOTATION_ANNOTATION, scope)) {
DirectClassInheritorsSearch.search(javaLangAnnotation, scope, false).forEach(annotationClass -> {
ProgressManager.checkCanceled();
ContainerUtil.addIfNotNull(allAnnotationFiles, PsiUtilCore.getVirtualFile(annotationClass));
@@ -221,7 +223,8 @@ public class MetaAnnotationUtil {
}
@NotNull
public static Stream<PsiAnnotation> findMetaAnnotations(@NotNull PsiModifierListOwner listOwner, @NotNull Collection<String> annotations) {
public static Stream<PsiAnnotation> findMetaAnnotations(@NotNull PsiModifierListOwner listOwner,
@NotNull Collection<String> annotations) {
Stream<PsiAnnotation> directAnnotations = Stream.of(AnnotationUtil.findAnnotations(listOwner, annotations));
Stream<PsiClass> lazyResolvedAnnotations =
@@ -25,6 +25,7 @@
<orderEntry type="module" module-name="intellij.java.execution" exported="" />
<orderEntry type="module" module-name="intellij.platform.externalSystem.impl" scope="RUNTIME" />
<orderEntry type="library" name="KotlinTest" level="project" />
<orderEntry type="module" module-name="intellij.platform.jps.build" />
</component>
<component name="copyright">
<Base>
@@ -3,6 +3,7 @@ package com.intellij.testFramework;
import com.intellij.compiler.CompilerManagerImpl;
import com.intellij.compiler.CompilerTestUtil;
import com.intellij.compiler.server.BuildManager;
import com.intellij.diagnostic.ThreadDumper;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.PathMacros;
@@ -21,6 +22,7 @@ import com.intellij.openapi.roots.CompilerProjectExtension;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
@@ -40,12 +42,12 @@ import com.intellij.util.io.FileTreePrinterKt;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.cmdline.LogSetup;
import org.jetbrains.jps.model.serialization.JpsGlobalLoader;
import org.junit.Assert;
import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -221,6 +223,7 @@ public class CompilerTester {
}
}
}
enableDebugLogging();
runnable.consume(callback);
});
@@ -232,6 +235,7 @@ public class CompilerTester {
}
}
printBuildLog();
callback.throwException();
if (!((CompilerManagerImpl)CompilerManager.getInstance(getProject())).waitForExternalJavacToTerminate(1, TimeUnit.MINUTES)) {
@@ -241,6 +245,45 @@ public class CompilerTester {
return callback.getMessages();
}
public static void printBuildLog() {
File logDirectory = BuildManager.getBuildLogDirectory();
File[] files = logDirectory.listFiles(file -> file.getName().endsWith(".log"));
if (files == null || files.length == 0) {
LOG.debug("No *.log files in " + logDirectory + " after build");
return;
}
Arrays.sort(files, Comparator.comparing(File::getName));
for (File file : files) {
LOG.debug(file.getName() + ":");
try {
List<String> lines = FileUtil.loadLines(file);
for (String line : lines) {
LOG.debug(line);
}
}
catch (IOException e) {
LOG.debug("Failed to load contents: " + e.getMessage());
}
}
}
public static void enableDebugLogging() throws IOException {
File logDirectory = BuildManager.getBuildLogDirectory();
FileUtil.delete(logDirectory);
FileUtil.createDirectory(logDirectory);
Properties properties = new Properties();
try (InputStream config = LogSetup.readDefaultLogConfig()) {
properties.load(config);
}
properties.setProperty("log4j.rootLogger", "debug, file");
File logFile = new File(logDirectory, LogSetup.LOG_CONFIG_FILE_NAME);
try (OutputStream output = new BufferedOutputStream(new FileOutputStream(logFile))) {
properties.store(output, null);
}
}
private static void refreshVfs(String path) {
VirtualFile vFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path));
if (vFile != null) {
@@ -32,9 +32,8 @@ import java.nio.charset.StandardCharsets;
*/
public class LogSetup {
private static final String LOG_CONFIG_FILE_NAME = "build-log.properties";
public static final String LOG_CONFIG_FILE_NAME = "build-log.properties";
private static final String LOG_FILE_NAME = "build.log";
private static final String DEFAULT_LOGGER_CONFIG = "defaultLogConfig.properties";
private static final String LOG_FILE_MACRO = "$LOG_FILE_PATH$";
public static void initLoggers() {
@@ -64,7 +63,7 @@ public class LogSetup {
private static void ensureLogConfigExists(final File logConfig) throws IOException {
if (!logConfig.exists()) {
FileUtil.createIfDoesntExist(logConfig);
try(InputStream in = LogSetup.class.getResourceAsStream("/" + DEFAULT_LOGGER_CONFIG)) {
try(InputStream in = readDefaultLogConfig()) {
if (in != null) {
try (FileOutputStream out = new FileOutputStream(logConfig)) {
FileUtil.copy(in, out);
@@ -74,6 +73,10 @@ public class LogSetup {
}
}
public static InputStream readDefaultLogConfig() {
return LogSetup.class.getResourceAsStream("/defaultLogConfig.properties");
}
private static class MyLoggerFactory implements Logger.Factory {
@NotNull
@Override
@@ -6,6 +6,7 @@ syntax.error.missing.closing.quote=Missing closing quote
syntax.error.illegal.escape.sequence=Illegal escape sequence
syntax.error.illegal.unicode.escape.sequence=Illegal unicode escape sequence
syntax.error.illegal.floating.point.literal=Illegal floating point literal
syntax.error.control.char.in.string=Control character ''{0}'' is not allowed in string literals
# Inspections
json.inspection.group=JSON and JSON5
@@ -63,10 +63,9 @@ public class JsonLiteralAnnotator implements Annotator {
for (Pair<TextRange, String> fragment: fragments) {
for (JsonLiteralChecker checker: extensions) {
if (!checker.isApplicable(element)) continue;
String error = checker.getErrorForStringFragment(fragment.getSecond());
Pair<TextRange, String> error = checker.getErrorForStringFragment(fragment, stringLiteral);
if (error != null) {
final TextRange fragmentRange = fragment.getFirst();
holder.createErrorAnnotation(fragmentRange.shiftRight(elementOffset), error);
holder.createErrorAnnotation(error.getFirst().shiftRight(elementOffset), error.second);
}
}
}
@@ -1,7 +1,10 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.json.codeinsight;
import com.intellij.json.psi.JsonStringLiteral;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
@@ -12,7 +15,7 @@ public interface JsonLiteralChecker {
String getErrorForNumericLiteral(String literalText);
@Nullable
String getErrorForStringFragment(String fragmentText);
Pair<TextRange, String> getErrorForStringFragment(Pair<TextRange, String> fragmentText, JsonStringLiteral stringLiteral);
boolean isApplicable(PsiElement element);
}
@@ -3,6 +3,9 @@ package com.intellij.json.codeinsight;
import com.intellij.json.JsonBundle;
import com.intellij.json.JsonDialectUtil;
import com.intellij.json.psi.JsonStringLiteral;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
@@ -29,8 +32,25 @@ public class StandardJsonLiteralChecker implements JsonLiteralChecker {
@Nullable
@Override
public String getErrorForStringFragment(String fragmentText) {
return getStringError(fragmentText);
public Pair<TextRange, String> getErrorForStringFragment(Pair<TextRange, String> fragment, JsonStringLiteral stringLiteral) {
if (fragment.getSecond().chars().anyMatch(c -> c <= '\u001F')) { // fragments are cached, string values - aren't; go inside only if we encountered a potentially 'wrong' char
final String text = stringLiteral.getText();
if (new TextRange(0, text.length()).contains(fragment.first)) {
final int startOffset = fragment.first.getStartOffset();
final String part = text.substring(startOffset, fragment.first.getEndOffset());
char[] array = part.toCharArray();
for (int i = 0; i < array.length; i++) {
char c = array[i];
if (c <= '\u001F') {
return Pair.create(new TextRange(startOffset + i, startOffset + i + 1),
JsonBundle
.message("syntax.error.control.char.in.string", "\\u" + Integer.toHexString(c | 0x10000).substring(1)));
}
}
}
}
final String error = getStringError(fragment.second);
return error == null ? null : Pair.create(fragment.first, error);
}
@Nullable
@@ -17,6 +17,7 @@ public class JsonEditorOptions implements PersistentStateComponent<JsonEditorOpt
public boolean COMMA_ON_ENTER = true;
public boolean COMMA_ON_MATCHING_BRACES = true;
public boolean AUTO_QUOTE_PROP_NAME = true;
public boolean AUTO_WHITESPACE_AFTER_COLON = true;
public boolean ESCAPE_PASTED_TEXT = true;
@Nullable
@@ -24,6 +24,9 @@ public class JsonSmartKeysConfigurable extends BeanConfigurable<JsonEditorOption
checkBox("Automatically add quotes to property names when typing ':'",
() -> settings.AUTO_QUOTE_PROP_NAME,
v -> settings.AUTO_QUOTE_PROP_NAME = v);
checkBox("Automatically add whitespace when typing ':' after property namess",
() -> settings.AUTO_WHITESPACE_AFTER_COLON,
v -> settings.AUTO_WHITESPACE_AFTER_COLON = v);
}
@Override
@@ -4,14 +4,18 @@ package com.intellij.json.editor;
import com.intellij.codeInsight.editorActions.TypedHandlerDelegate;
import com.intellij.codeInsight.editorActions.smartEnter.SmartEnterProcessor;
import com.intellij.json.JsonDialectUtil;
import com.intellij.json.JsonElementTypes;
import com.intellij.json.psi.*;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiErrorElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
@@ -21,6 +25,7 @@ public class JsonTypedHandler extends TypedHandlerDelegate {
public Result charTyped(char c, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
if (file instanceof JsonFile) {
processPairedBracesComma(c, editor, file);
addWhiteSpaceAfterColonIfNeeded(c, editor, file);
}
return Result.CONTINUE;
}
@@ -38,6 +43,26 @@ public class JsonTypedHandler extends TypedHandlerDelegate {
return Result.CONTINUE;
}
private static void addWhiteSpaceAfterColonIfNeeded(char c,
@NotNull Editor editor,
@NotNull PsiFile file) {
if (c != ':' || !JsonEditorOptions.getInstance().AUTO_WHITESPACE_AFTER_COLON) return;
int offset = editor.getCaretModel().getOffset();
PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());
PsiElement element = PsiTreeUtil.skipWhitespacesBackward(file.findElementAt(offset));
if (!(element instanceof JsonProperty)) return;
final ASTNode[] children = element.getNode().getChildren(TokenSet.create(JsonElementTypes.COLON));
if (children.length == 0) return;
final ASTNode colon = children[0];
final ASTNode next = colon.getTreeNext();
final String text = next.getText();
if (text.length() == 0 || !StringUtil.isEmptyOrSpaces(text)) {
final int insOffset = colon.getStartOffset() + 1;
editor.getDocument().insertString(insOffset, " ");
editor.getCaretModel().moveToOffset(insOffset + 1);
}
}
private static void addPropertyNameQuotesIfNeeded(char c,
@NotNull Editor editor,
@NotNull PsiFile file) {
@@ -5,6 +5,9 @@ import com.intellij.json.JsonDialectUtil;
import com.intellij.json.codeinsight.JsonLiteralChecker;
import com.intellij.json.codeinsight.StandardJsonLiteralChecker;
import com.intellij.json.json5.Json5Language;
import com.intellij.json.psi.JsonStringLiteral;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.Nullable;
@@ -22,7 +25,8 @@ public class Json5JsonLiteralChecker implements JsonLiteralChecker {
@Nullable
@Override
public String getErrorForStringFragment(String fragmentText) {
public Pair<TextRange, String> getErrorForStringFragment(Pair<TextRange, String> fragment, JsonStringLiteral stringLiteral) {
String fragmentText = fragment.second;
if (fragmentText.startsWith("\\") && fragmentText.length() > 1 && fragmentText.endsWith("\n")) {
if (StringUtil.isEmptyOrSpaces(fragmentText.substring(1, fragmentText.length() - 1))) {
return null;
@@ -37,7 +41,8 @@ public class Json5JsonLiteralChecker implements JsonLiteralChecker {
return null;
}
return StandardJsonLiteralChecker.getStringError(fragmentText);
final String error = StandardJsonLiteralChecker.getStringError(fragmentText);
return error == null ? null : Pair.create(fragment.first, error);
}
@Override
@@ -639,7 +639,7 @@ public class JsonSchemaCompletionContributor extends CompletionContributor {
editor.getCaretModel().moveToOffset(newOffset);
}
if (!walker.invokeEnterBeforeObjectAndArray()) {
if (!walker.invokeEnterBeforeObjectAndArray() && !stringToInsert.equals(": ")) {
formatInsertedString(context, stringToInsert.length());
}
@@ -62,6 +62,11 @@ public class JsonHighlightingTest extends JsonHighlightingTestBase {
doTestHighlighting(false, true, true);
}
public void testTabInString() {
enableStandardComplianceInspection(true, true);
doTestHighlighting(false, true, true);
}
public void testSemanticHighlighting() {
// WEB-11239
doTest();
@@ -68,11 +68,11 @@ public class JsonTypingHandlingTest extends JsonTestCase {
}
public void testAutoQuotesForPropName() {
doTestColon( "{ x<caret>}", "{\n" +
" \"x\":\n" +
" \"x\": <caret>\n" +
"}");
}
public void testAutoQuotesForPropNameFalse1() {
doTestColon( "{ \"x\"<caret>}", "{ \"x\":<caret>}");
doTestColon( "{ \"x\"<caret>}", "{ \"x\": <caret>}");
}
public void testAutoQuotesForPropNameFalse2() {
doTestColon( "{ \"x<caret>\"}", "{ \"x:<caret>\"}");
@@ -93,6 +93,10 @@ public class JsonBySchemaHeavyCompletionTest extends JsonBySchemaHeavyCompletion
baseInsertTest("insertPropertyName", "testNameWithDefaultStringValueComma");
}
public void testWhitespaceAfterColon() throws Exception {
baseInsertTest("addWhitespaceAfterColon", "colon");
}
public void testArrayLiteral() throws Exception {
baseInsertTest("insertArrayOrObjectLiteral", "arrayLiteral");
complete();
@@ -0,0 +1,4 @@
{
"mode": "ftp<error descr="Control character '\u0009' is not allowed in string literals"> </error>",
"name": "test\t"
}
@@ -0,0 +1,7 @@
{
"properties": {
"test": {
"type": "integer"
}
}
}
@@ -0,0 +1,3 @@
{
tes<caret>
}
@@ -0,0 +1,3 @@
{
"test": <caret>
}
@@ -47,6 +47,7 @@ import com.intellij.xml.util.XmlStringUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -424,12 +425,21 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
private static final int POST_UPDATE_ALL = 5;
private static final AtomicInteger RESTART_REQUESTS = new AtomicInteger();
@TestOnly
static boolean isRestartPending() {
return RESTART_REQUESTS.get() > 0;
}
private static void cancelAndRestartDaemonLater(@NotNull ProgressIndicator progress,
@NotNull final Project project) throws ProcessCanceledException {
RESTART_REQUESTS.incrementAndGet();
progress.cancel();
Application application = ApplicationManager.getApplication();
int delay = application.isUnitTestMode() ? 0 : RESTART_DAEMON_RANDOM.nextInt(100);
EdtExecutorService.getScheduledExecutorInstance().schedule(() -> {
RESTART_REQUESTS.decrementAndGet();
if (!project.isDisposed()) {
DaemonCodeAnalyzer.getInstance(project).restart();
}
@@ -58,7 +58,8 @@ class ApplicationInfoProperties {
minorVersionMainPart = minorVersion.takeWhile { it != '.' }
isEAP = Boolean.parseBoolean(root.version.first().@eap)
shortCompanyName = root.company.first().@shortName ?: shortenCompanyName(companyName)
svgRelativePath = root.icon.first().@svg
def svgPath = root.icon.first().@svg
svgRelativePath = isEAP && root."icon-eap" != null ? (root."icon-eap".first().@svg ?: svgPath) : svgPath
}
String getUpperCaseProductName() { shortProductName.toUpperCase() }
@@ -376,7 +376,7 @@ class CommunityLibraryLicenses {
licenseUrl: "https://github.com/MarkusBernhardt/proxy-vole/blob/master/LICENSE.md"),
new LibraryLicense(name: "pty4j", libraryName: "pty4j", version: "0.8.4", license: "Eclipse Public License v1.0",
url: "https://github.com/JetBrains/pty4j"),
new LibraryLicense(name: "PureJavaComm", libraryName: "purejavacomm", version: "0.0.11.1", license: "BSD",
new LibraryLicense(name: "PureJavaComm", libraryName: "pty4j", version: "0.0.11.1", license: "BSD",
url: "https://github.com/nyholku/purejavacomm"),
new LibraryLicense(name: "pycodestyle.py", attachedTo: "intellij.python.helpers", version: "2.3.1", license: "MIT",
url: "http://pycodestyle.readthedocs.io/"),
@@ -387,7 +387,7 @@ class CommunityLibraryLicenses {
licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0"),
new LibraryLicense(name: "Roboto", attachedTo: "intellij.platform.resources", version: "1.100141", license: "Apache 2.0",
url: "https://github.com/google/roboto/blob/master/LICENSE"),
new LibraryLicense(name: "sa-jdwp", version: "1.0.4", license: "GPL 2.0 + Classpath", url: "https://github.com/JetBrains/jdk-sa-jdwp",
new LibraryLicense(name: "sa-jdwp", version: "1.0.5", license: "GPL 2.0 + Classpath", url: "https://github.com/JetBrains/jdk-sa-jdwp",
licenseUrl: "https://raw.githubusercontent.com/JetBrains/jdk-sa-jdwp/master/LICENSE.txt"),
new LibraryLicense(name: "Saxon-6.5.5", version: "6.5.5", license: "Mozilla Public License", url: "http://saxon.sourceforge.net/",
licenseUrl: "http://www.mozilla.org/MPL/"),
@@ -33,12 +33,14 @@ private fun listGitTree(
File(it).relativeTo(repo).path
} ?: ""
log("Inspecting $repo")
try {
if (BUILD_SERVER == null) try {
listOf(GIT, "pull", "--rebase").execute(repo)
}
catch (e: Exception) {
listOf(GIT, "rebase", "--abort").execute(repo)
throw e
callSafely {
listOf(GIT, "rebase", "--abort").execute(repo)
}
log("Unable to pull changes for $repo")
}
return listOf(GIT, "ls-tree", "HEAD", "-r", relativeDirToList)
.execute(repo).trim().lineSequence()
@@ -52,7 +52,7 @@ private fun sendNotification(isSuccess: Boolean) {
}
}
private val BUILD_SERVER = System.getProperty("teamcity.serverUrl")
internal val BUILD_SERVER = System.getProperty("teamcity.serverUrl")
private val BUILD_CONF = System.getProperty("teamcity.buildType.id")
private val DATE_FORMAT = SimpleDateFormat("yyyyMMdd'T'HHmmsszzz")
@@ -2,6 +2,7 @@
package org.jetbrains.intellij.build.images.sync
import java.io.File
import java.util.concurrent.TimeUnit
import java.util.function.Consumer
internal lateinit var logger: Consumer<String>
@@ -23,7 +24,7 @@ internal fun List<String>.execute(workingDir: File?, silent: Boolean = false): S
.start()
val output = process.inputStream.bufferedReader().use { it.readText() }
val error = process.errorStream.bufferedReader().use { it.readText() }
process.waitFor()
process.waitFor(1, TimeUnit.MINUTES)
if (process.exitValue() != 0) {
error("Command ${this} failed with ${process.exitValue()} : $error")
}
@@ -81,12 +81,7 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
@NotNull
public static AccessToken start() {
// get useful information about the write action
return start(4);
}
@NotNull
private static AccessToken start(int stackDepthToMeaningfulFrame) {
Class callerClass = ObjectUtils.notNull(ReflectionUtil.getCallerClass(stackDepthToMeaningfulFrame), WriteAction.class);
Class callerClass = ObjectUtils.notNull(ReflectionUtil.getCallerClass(3), WriteAction.class);
return start(callerClass);
}
@@ -106,7 +101,7 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
* Must be called from the EDT.
*/
public static <E extends Throwable> void run(@NotNull ThrowableRunnable<E> action) throws E {
AccessToken token = start(4);
AccessToken token = start(action.getClass());
try {
action.run();
}
@@ -120,13 +115,7 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
* Must be called from the EDT.
*/
public static <T, E extends Throwable> T compute(@NotNull ThrowableComputable<T, E> action) throws E {
AccessToken token = start(4);
try {
return action.compute();
}
finally {
token.finish();
}
return ApplicationManager.getApplication().runWriteAction(action);
}
/**
@@ -159,13 +148,7 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
public static <T, E extends Throwable> T computeAndWait(@NotNull ThrowableComputable<T, E> action) throws E {
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
AccessToken token = start(action.getClass());
try {
return action.compute();
}
finally {
token.finish();
}
return ApplicationManager.getApplication().runWriteAction(action);
}
if (application.isReadAccessAllowed()) {
@@ -174,16 +157,12 @@ public abstract class WriteAction<T> extends BaseActionRunnable<T> {
final AtomicReference<T> result = new AtomicReference<>();
final AtomicReference<Throwable> exception = new AtomicReference<>();
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
AccessToken token = start(action.getClass());
try {
result.set(action.compute());
result.set(compute(action));
}
catch (Throwable e) {
exception.set(e);
}
finally {
token.finish();
}
});
Throwable t = exception.get();
@@ -377,6 +377,7 @@ public abstract class WriteCommandAction<T> extends BaseActionRunnable<T> {
/**
* @deprecated use {@link FileModificationService#preparePsiElementsForWrite(Collection)} (to be removed in IDEA 2018)
*/
@Deprecated
public static boolean ensureFilesWritable(@NotNull Project project, @NotNull Collection<PsiFile> psiFiles) {
return FileModificationService.getInstance().preparePsiElementsForWrite(psiFiles);
}
@@ -4,6 +4,7 @@ package com.intellij.openapi.components;
/**
* @deprecated Not used anymore.
*/
@Deprecated
public interface ApplicationComponent extends BaseComponent {
/**
* @deprecated Not used anymore.
@@ -13,7 +13,6 @@ import java.util.EventListener;
* @see com.intellij.openapi.editor.Document#addDocumentListener(DocumentListener)
* @see EditorEventMulticaster#addDocumentListener(DocumentListener)
*/
@SuppressWarnings("JavadocReference")
public interface DocumentListener extends EventListener{
DocumentListener[] EMPTY_ARRAY = new DocumentListener[0];
ArrayFactory<DocumentListener> ARRAY_FACTORY = count -> count == 0 ? EMPTY_ARRAY : new DocumentListener[count];
@@ -35,10 +35,9 @@ package com.intellij.openapi.project;
* <li> {@link com.intellij.lang.injection.MultiHostInjector}s
*
* @author peter
* @see com.intellij.openapi.project.DumbService
* @see com.intellij.openapi.project.DumbAwareRunnable
* @see DumbService
* @see DumbAwareRunnable
* @see PossiblyDumbAware
*/
@SuppressWarnings("JavadocReference")
public interface DumbAware {
}
@@ -131,7 +131,6 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica
*
* @return the path
*/
@SuppressWarnings("JavadocReference")
@NotNull
public abstract String getPath();
@@ -327,7 +326,6 @@ public abstract class VirtualFile extends UserDataHolderBase implements Modifica
* When IDEA has no idea what the file type is (i.e. file type is not registered via {@link FileTypeRegistry}),
* it returns {@link com.intellij.openapi.fileTypes.FileTypes#UNKNOWN}
*/
@SuppressWarnings("JavadocReference")
@NotNull
public FileType getFileType() {
return FileTypeRegistry.getInstance().getFileTypeByFile(this);
@@ -106,7 +106,7 @@ public interface PsiReference {
boolean isReferenceTo(@NotNull PsiElement element);
/**
* Returns the array of String, {@link PsiElement} and/or {@link LookupElement}
* Returns the array of String, {@link PsiElement} and/or {@link com.intellij.codeInsight.lookup.LookupElement}
* instances representing all identifiers that are visible at the location of the reference. The contents
* of the returned array is used to build the lookup list for basic code completion. (The list
* of visible identifiers may not be filtered by the completion prefix string - the
@@ -116,7 +116,6 @@ public interface PsiReference {
*
* @return the array of available identifiers.
*/
@SuppressWarnings("JavadocReference")
@NotNull
default Object[] getVariants() {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
@@ -3,6 +3,7 @@ package com.intellij.psi.util;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Key;
@@ -18,10 +19,7 @@ import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.templateLanguages.OuterLanguageElement;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.PairProcessor;
import com.intellij.util.SmartList;
import com.intellij.util.*;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
@@ -123,8 +121,17 @@ public class PsiTreeUtil {
public static PsiElement findCommonParent(@NotNull PsiElement element1, @NotNull PsiElement element2) {
// optimization
if (element1 == element2) return element1;
final PsiFile containingFile = element1.getContainingFile();
final PsiElement topLevel = containingFile == element2.getContainingFile() ? containingFile : null;
PsiFile file1 = element1.getContainingFile();
PsiFile file2 = element2.getContainingFile();
if (file1 != null && file2 != null) {
InjectedLanguageManager ilm = InjectedLanguageManager.getInstance(file1.getProject());
if (ilm.isInjectedFragment(file1) != ilm.isInjectedFragment(file2)) {
// injected and non-injected files have no common ancestor
return null;
}
}
PsiElement topLevel = file1 == file2 ? file1 : null;
int depth1 = getDepth(element1, topLevel);
int depth2 = getDepth(element2, topLevel);
@@ -22,6 +22,7 @@ public abstract class GraphAlgorithms {
/**
* @deprecated use more generic {@link #findShortestPath(InboundSemiGraph, Object, Object)} instead
*/
@Deprecated
@Nullable
public abstract <Node> List<Node> findShortestPath(@NotNull Graph<Node> graph, @NotNull Node start, @NotNull Node finish);
@@ -45,7 +45,8 @@ public abstract class ApplicationInfoEx extends ApplicationInfo {
public abstract String getSmallIconUrl();
public abstract String getBigIconUrl();
@Nullable
public abstract String getApplicationSvgIconUrl();
@Nullable
public abstract File getSvgIconFile();
@@ -61,8 +61,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
@SuppressWarnings("UseJBColor") private Color mySplashTextColor = new Color(0, 35, 135); // idea blue
private String myIconUrl = "/icon.png";
private String mySmallIconUrl = "/icon_small.png";
private String myBigIconUrl;
private String mySvgIconUrl;
private String mySvgEapIconUrl;
private String myToolWindowIconUrl = "/toolwindows/toolWindowProject.png";
private String myWelcomeScreenLogoUrl;
@@ -385,8 +385,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
@Override
@Nullable
public String getBigIconUrl() {
return myBigIconUrl;
public String getApplicationSvgIconUrl() {
return isEAP() && mySvgEapIconUrl != null ? mySvgEapIconUrl : mySvgIconUrl;
}
@Nullable
@@ -746,13 +746,16 @@ public class ApplicationInfoImpl extends ApplicationInfoEx {
if (iconElement != null) {
myIconUrl = iconElement.getAttributeValue(ATTRIBUTE_SIZE32);
mySmallIconUrl = iconElement.getAttributeValue(ATTRIBUTE_SIZE16);
myBigIconUrl = iconElement.getAttributeValue(ATTRIBUTE_SIZE128, (String)null);
final String toolWindowIcon = iconElement.getAttributeValue(ATTRIBUTE_SIZE12);
if (toolWindowIcon != null) {
myToolWindowIconUrl = toolWindowIcon;
}
mySvgIconUrl = iconElement.getAttributeValue("svg");
}
Element iconEap = getChild(parentNode, "icon-eap");
if (iconEap != null) {
mySvgEapIconUrl = iconEap.getAttributeValue("svg");
}
Element packageElement = getChild(parentNode, ELEMENT_PACKAGE);
if (packageElement != null) {
@@ -46,6 +46,7 @@ public interface EditorCustomElementRenderer {
/**
* @deprecated Override/use {@link #calcWidthInPixels(Inlay)} instead. This method will be removed.
*/
@Deprecated
default int calcWidthInPixels(@NotNull Editor editor) {
throw new RuntimeException("Method not implemented");
}
@@ -79,6 +80,7 @@ public interface EditorCustomElementRenderer {
/**
* @deprecated Override/use {@link #paint(Inlay, Graphics, Rectangle, TextAttributes)} instead. This method will be removed.
*/
@Deprecated
default void paint(@NotNull Editor editor, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) {
throw new RuntimeException("Method not implemented");
}
@@ -98,6 +100,7 @@ public interface EditorCustomElementRenderer {
/**
* @deprecated Override/use {@link #getContextMenuGroupId(Inlay)} instead. This method will be removed.
*/
@Deprecated
default String getContextMenuGroupId() {
return null;
}

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 133 B

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1022 B

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 474 B

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 334 B

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 334 B

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 773 B

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 558 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

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