Skip to content

Commit

Permalink
Update the Groovy plug-in to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Feb 10, 2020
1 parent b04c8fc commit 19584c5
Show file tree
Hide file tree
Showing 39 changed files with 3,514 additions and 3,388 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,8 @@ public void testDGMDeclaring4() {
@Test // https://github.com/groovy/groovy-eclipse/issues/1002
public void testDGMDeclaring5() {
String contents = "new StringBuilder().size()";
assertDeclType(contents, "size", "org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods");
String vmplugin = isAtLeastGroovy(30) ? "8" : "5";
assertDeclType(contents, "size", "org.codehaus.groovy.vmplugin.v" + vmplugin + ".PluginDefaultGroovyMethods");
}

@Test // https://github.com/groovy/groovy-eclipse/issues/1002
Expand All @@ -1015,7 +1016,8 @@ public void testDGMDeclaring6() {
@Test // https://github.com/groovy/groovy-eclipse/issues/1002
public void testDGMDeclaring7() {
String contents = "Thread.State.NEW.next().name()";
assertDeclType(contents, "next", "org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods");
String vmplugin = isAtLeastGroovy(30) ? "8" : "5";
assertDeclType(contents, "next", "org.codehaus.groovy.vmplugin.v" + vmplugin + ".PluginDefaultGroovyMethods");
}

@Test // https://github.com/groovy/groovy-eclipse/issues/372
Expand Down
1 change: 0 additions & 1 deletion base/org.codehaus.groovy30/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<file-match-pattern match-pattern="groovy/classgen/EnumVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/ExtendedVerifier.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/Verifier.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/WriterController.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticInvocationWriter.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/classgen/asm/sc/StaticPropertyAccessHelper.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/control/CompilationUnit.java" include-pattern="false" />
Expand Down
3 changes: 1 addition & 2 deletions base/org.codehaus.groovy30/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ Export-Package: groovy.beans;version="3.0.0",
org.codehaus.groovy.vmplugin.v5;version="3.0.0",
org.codehaus.groovy.vmplugin.v6;version="3.0.0",
org.codehaus.groovy.vmplugin.v7;version="3.0.0",
org.codehaus.groovy.vmplugin.v8;version="3.0.0",
org.codehaus.groovy.vmplugin.v9;version="3.0.0"
org.codehaus.groovy.vmplugin.v8;version="3.0.0"
Require-Bundle: org.eclipse.core.runtime,
org.apache.ant;resolution:=optional,
org.junit;resolution:=optional
Expand Down
1 change: 1 addition & 0 deletions base/org.codehaus.groovy30/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
2019-10-25: GROOVY_3_0_0_RC_1
2019-12-08: GROOVY_3_0_0_RC_2
2020-01-15: GROOVY_3_0_0_RC_3
2020-02-10: GROOVY_3_0_0
8 changes: 4 additions & 4 deletions base/org.codehaus.groovy30/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ <h4>groovy-3.0.0-indy.jar</h4>
<h4>groovy-test-3.0.0-indy.jar</h4>

<ul>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.0-rc-3.zip">https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.0-rc-3.zip</a></li>
<li>Sources available at: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-src-3.0.0-rc-3.zip">https://dl.bintray.com/groovy/maven/apache-groovy-src-3.0.0-rc-3.zip</a></li>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.0.zip">https://dl.bintray.com/groovy/maven/apache-groovy-binary-3.0.0.zip</a></li>
<li>Sources available at: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-src-3.0.0.zip">https://dl.bintray.com/groovy/maven/apache-groovy-src-3.0.0.zip</a></li>
<li>License kind: ASL</li>
<li>License URL: <a href="https://www.apache.org/licenses/LICENSE-2.0.html">https://www.apache.org/licenses/LICENSE-2.0.html</a></li>
<li>License text: <a href="about_files/asl2-license.txt">asl2-license.txt</a></li>
Expand All @@ -52,7 +52,7 @@ <h4>groovy-templates-3.0.0.jar</h4>
<h4>groovy-xml-3.0.0.jar</h4>

<ul>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0-rc-3.zip">https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0-rc-3.zip</a></li>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0.zip">https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0.zip</a></li>
<li>License kind: ASL</li>
<li>License URL: <a href="https://www.apache.org/licenses/LICENSE-2.0.html">https://www.apache.org/licenses/LICENSE-2.0.html</a></li>
<li>License text: <a href="about_files/asl2-license.txt">asl2-license.txt</a></li>
Expand All @@ -61,7 +61,7 @@ <h4>groovy-xml-3.0.0.jar</h4>
<h4>jline-2.14.6.jar</h4>

<ul>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0-rc-3.zip">https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0-rc-3.zip</a></li>
<li>Obtained from: <a href="https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0.zip">https://dl.bintray.com/groovy/maven/apache-groovy-sdk-3.0.0.zip</a></li>
<li>License kind: BSD</li>
<li>License URL: <a href="https://www.opensource.org/licenses/bsd-license.php">https://www.opensource.org/licenses/bsd-license.php</a></li>
<li>License text: <a href="about_files/jline2-license.txt">jline2-license.txt</a></li>
Expand Down
Binary file modified base/org.codehaus.groovy30/lib/console/groovy-console-3.0.0.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/console/groovy-swing-3.0.0.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/console/groovy-templates-3.0.0.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/console/groovy-xml-3.0.0.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-3.0.0-indy.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-3.0.0-javadoc.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-3.0.0-sources.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-test-3.0.0-indy.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-test-3.0.0-javadoc.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/groovy-test-3.0.0-sources.jar
Binary file not shown.
Binary file modified base/org.codehaus.groovy30/lib/shell/groovy-groovysh-3.0.0.jar
Binary file not shown.
64 changes: 38 additions & 26 deletions base/org.codehaus.groovy30/src/GroovyLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,25 @@ options {
super.emit(token);
}

private static final Set<Integer> REGEX_CHECK_SET =
Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(Identifier, CapitalizedIdentifier, NullLiteral, BooleanLiteral, THIS, RPAREN, RBRACK, RBRACE, IntegerLiteral, FloatingPointLiteral, StringLiteral, GStringEnd, INC, DEC)));
private static final int[] REGEX_CHECK_ARRAY =
/* GRECLIPSE edit
IntStream.of(
*/
{
// GRECLIPSE end
Identifier, CapitalizedIdentifier, NullLiteral, BooleanLiteral, THIS, RPAREN, RBRACK, RBRACE,
IntegerLiteral, FloatingPointLiteral, StringLiteral, GStringEnd, INC, DEC
/* GRECLIPSE edit
).sorted().toArray();
*/
};
static {
Arrays.sort(REGEX_CHECK_ARRAY);
}
// GRECLIPSE end

private boolean isRegexAllowed() {
if (REGEX_CHECK_SET.contains(this.lastTokenType)) {
if (Arrays.binarySearch(REGEX_CHECK_ARRAY, this.lastTokenType) >= 0) {
return false;
}

Expand Down Expand Up @@ -104,10 +118,12 @@ options {
return this.lastTokenType;
}

@SuppressWarnings("unused")
public int getLine() {
return line;
}

@SuppressWarnings("unused")
public int getColumn() {
return column;
}
Expand All @@ -129,22 +145,6 @@ options {
}
}

/* GRECLIPSE edit
private static final Map<String, String> PAREN_MAP = Collections.unmodifiableMap(new HashMap<String, String>() {
{
put("(", ")");
put("[", "]");
put("{", "}");
}
});
*/
private static final Map<String, String> PAREN_MAP = org.apache.groovy.util.Maps.of(
"(", ")",
"[", "]",
"{", "}"
);
// GRECLIPSE end

protected void enterParenCallback(String text) {}

protected void exitParenCallback(String text) {}
Expand All @@ -154,19 +154,18 @@ options {
private void enterParen() {
String text = getText();
enterParenCallback(text);
parenStack.push(new Paren(text, this.lastTokenType, getLine(), getCharPositionInLine()));
}

private void exitParen() {
Paren paren = parenStack.peek();
String text = getText();
require(null != paren, "Too many '" + text + "'");
require(text.equals(PAREN_MAP.get(paren.getText())),
"'" + paren.getText() + "'" + new PositionInfo(paren.getLine(), paren.getColumn()) + " can not match '" + text + "'", -1);
exitParenCallback(text);
Paren paren = parenStack.peek();
if (null == paren) return;
parenStack.pop();
}

private boolean isInsideParens() {
Paren paren = parenStack.peek();
Expand All @@ -175,6 +174,7 @@ options {
if (null == paren) {
return false;
}

return ("(".equals(paren.getText()) && TRY != paren.getLastTokenType()) // we don't treat try-paren(i.e. try (....)) as parenthesis
|| "[".equals(paren.getText());
}
Expand Down Expand Up @@ -208,6 +208,15 @@ options {
return getCharPositionInLine() + 1;
}

@Override
public int popMode() {
try {
return super.popMode();
} catch (EmptyStackException ignore) { // raised when parens are unmatched: too many ), ], or }
}

return Integer.MIN_VALUE;
}
// GRECLIPSE add
private void addComment(int type) {
String text = _input.getText(Interval.of(_tokenStartCharIndex, getCharIndex() - 1));
Expand Down Expand Up @@ -312,7 +321,8 @@ GStringPathPart
RollBackOne
: . {
// a trick to handle GStrings followed by EOF properly
if (EOF == _input.LA(1) && ('"' == _input.LA(-1) || '/' == _input.LA(-1))) {
int readChar = _input.LA(-1);
if (EOF == _input.LA(1) && ('"' == readChar || '/' == readChar)) {
setType(GStringEnd);
} else {
setChannel(HIDDEN);
Expand Down Expand Up @@ -817,8 +827,10 @@ NOT_IN : '!in' { isFollowedBy(_input, ' ', '\t', '\r', '\n'

LPAREN : '(' { this.enterParen(); } -> pushMode(DEFAULT_MODE);
RPAREN : ')' { this.exitParen(); } -> popMode;

LBRACE : '{' { this.enterParen(); } -> pushMode(DEFAULT_MODE);
RBRACE : '}' { this.exitParen(); } -> popMode;

LBRACK : '[' { this.enterParen(); } -> pushMode(DEFAULT_MODE);
RBRACK : ']' { this.exitParen(); } -> popMode;

Expand Down
Loading

0 comments on commit 19584c5

Please sign in to comment.