Skip to content

Commit

Permalink
Fix for #667: Add more support for highlighting reserved type name 'var'
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Aug 7, 2018
2 parents 4bebc19 + 975e11f commit f630f2a
Show file tree
Hide file tree
Showing 2,238 changed files with 1,175,637 additions and 1,834 deletions.
4 changes: 2 additions & 2 deletions Site-org.codehaus.groovy.eclipse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<relativePath>../pom.xml</relativePath>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.site</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-update-site</packaging>

<!--build>
Expand Down
18 changes: 9 additions & 9 deletions Site-org.codehaus.groovy.eclipse/site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<category-def name="org.codehaus.groovy.compilers" label="More Compilers (optional)">
<description>
The Groovy 2.4 compiler is installed automatically, but you may install any other Groovy compiler as well.
The Groovy 2.5 compiler is installed automatically, but you may install any other Groovy compiler as well.
</description>
</category-def>

Expand All @@ -27,35 +27,35 @@
</category-def>


<feature id="org.codehaus.groovy.eclipse.feature" url="features/org.codehaus.groovy.eclipse.feature_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy.eclipse.feature" url="features/org.codehaus.groovy.eclipse.feature_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.eclipse"/>
</feature>

<feature id="org.codehaus.groovy.eclipse.feature.source" url="features/org.codehaus.groovy.eclipse.feature.source_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy.eclipse.feature.source" url="features/org.codehaus.groovy.eclipse.feature.source_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.eclipse.sdk"/>
</feature>

<!--feature id="org.codehaus.groovy.jdt.patch" url="features/org.codehaus.groovy.jdt.patch_3.0.0.qualifier.jar" version="3.0.0.qualifier" patch="true">
<!--feature id="org.codehaus.groovy.jdt.patch" url="features/org.codehaus.groovy.jdt.patch_3.1.0.qualifier.jar" version="3.1.0.qualifier" patch="true">
<category name="org.codehaus.groovy.eclipse"/>
</feature-->

<!--feature id="org.codehaus.groovy.jdt.patch.source" url="features/org.codehaus.groovy.jdt.patch.source_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<!--feature id="org.codehaus.groovy.jdt.patch.source" url="features/org.codehaus.groovy.jdt.patch.source_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.eclipse.sdk"/>
</feature-->

<feature id="org.codehaus.groovy24.feature" url="features/org.codehaus.groovy24.feature_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy24.feature" url="features/org.codehaus.groovy24.feature_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.compilers"/>
</feature>

<feature id="org.codehaus.groovy25.feature" url="features/org.codehaus.groovy25.feature_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy25.feature" url="features/org.codehaus.groovy25.feature_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.compilers"/>
</feature>

<feature id="org.codehaus.groovy26.feature" url="features/org.codehaus.groovy26.feature_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy26.feature" url="features/org.codehaus.groovy26.feature_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.compilers"/>
</feature>

<feature id="org.codehaus.groovy.m2eclipse.feature" url="features/org.codehaus.groovy.m2eclipse.feature_3.0.0.qualifier.jar" version="3.0.0.qualifier">
<feature id="org.codehaus.groovy.m2eclipse.feature" url="features/org.codehaus.groovy.m2eclipse.feature_3.1.0.qualifier.jar" version="3.1.0.qualifier">
<category name="org.codehaus.groovy.m2eclipse"/>
</feature>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-SymbolicName: org.eclipse.jdt.groovy.core.tests.builder;singleton:=true
Bundle-Name: Builder Tests
Bundle-Vendor: Codehaus.org
Bundle-Version: 3.0.0.qualifier
Bundle-Version: 3.1.0.qualifier
Export-Package: org.eclipse.jdt.core.groovy.tests,
org.eclipse.jdt.core.groovy.tests.builder,
org.eclipse.jdt.core.groovy.tests.locations,
Expand Down
4 changes: 2 additions & 2 deletions base-test/org.eclipse.jdt.groovy.core.tests.builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<relativePath>../../pom.xml</relativePath>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.eclipse.jdt.groovy.core.tests.builder</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public void testClosure24() {
"}";
int start = contents.lastIndexOf("time");
int end = start + "time".length();
assertType(contents, start, end, "java.lang.Long", false);
assertType(contents, start, end, "java.lang.Long");
}

@Test
Expand All @@ -487,7 +487,7 @@ public void testClosure25() {
"}";
int start = contents.lastIndexOf("time");
int end = start + "time".length();
assertType(contents, start, end, "java.lang.Void", false);
assertType(contents, start, end, "java.lang.Void");
}

@Test
Expand All @@ -499,7 +499,25 @@ public void testClosure26() {
"}";
int start = contents.lastIndexOf("time");
int end = start + "time".length();
assertType(contents, start, end, "java.lang.Long", false);
assertType(contents, start, end, "java.lang.Long");
}

@Test // https://github.com/groovy/groovy-eclipse/issues/660
public void testClosure27() {
String contents =
"new Date().with { one, two = delegate ->\n" +
"}";
int offset = contents.indexOf("delegate");
assertType(contents, offset, offset + "delegate".length(), "java.util.Date");
}

@Test
public void testClosure28() {
String contents =
"def closure = { int i = 2 ->\n" +
"}";
int offset = contents.indexOf("2");
assertType(contents, offset, offset + 1, "java.lang.Integer");
}

@Test // closure within closure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ protected void doTestForTwoTypeReferences(String firstContents, String secondCon
if (contentsIsScript) {
firstMatchEnclosingElement = findType(secondClassName, second).getChildren()[offsetInParent];
} else {
// if not a script, then the first match is always enclosed in the type,
// if not a script, then the first match is always enclosed in the type
firstMatchEnclosingElement = findType(secondClassName, second);
}
// match is enclosed in run method (for script), or x method for class
// match is enclosed in run method (for script), or nth method for class
secondMatchEnclosingElement = findType(secondClassName, second).getChildren()[offsetInParent];

checkMatches(secondContents, firstClassName, pattern, second, firstMatchEnclosingElement, secondMatchEnclosingElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ public void testSearchForTypesClass1() throws Exception {

@Test
public void testSearchForTypesClass2() throws Exception {
doTestForTwoInClass("class Second extends First { First x() { } }");
doTestForTwoInClass("class Second extends First { First x() {}\n}");
}

@Test
public void testSearchForTypesClass3() throws Exception {
doTestForTwoInClass("class Second extends First { def x(First y) { } }");
doTestForTwoInClass("class Second extends First { def x(First y) {}\n}");
}

@Test
public void testSearchForTypesClass4() throws Exception {
doTestForTwoInClass("class Second extends First { def x(First ... y) { } }");
doTestForTwoInClass("class Second extends First { def x(First ... y) {}\n}");
}

@Test
public void testSearchForTypesClass5() throws Exception {
doTestForTwoInClassUseWithDefaultMethod("class Second extends First { def x(y = new First()) { } }");
doTestForTwoTypeReferences(FIRST_CONTENTS_CLASS, "class Second extends First { def x(y = new First()) {}\n}", false, 0);
}

@Test
public void testSearchForTypesClass6() throws Exception {
doTestForTwoInClassWithImplements("class Second implements First { def x(First y) { } }");
doTestForTwoTypeReferences(FIRST_CONTENTS_INTERFACE, "class Second implements First { def x(First y) {}\n}", false, 0);
}

@Test
Expand Down Expand Up @@ -466,15 +466,4 @@ private void doTestForTwoInScript(String secondContents) throws Exception {
private void doTestForTwoInClass(String secondContents) throws Exception {
doTestForTwoTypeReferences(FIRST_CONTENTS_CLASS, secondContents, false, 0);
}

private void doTestForTwoInClassUseWithDefaultMethod(String secondContents) throws Exception {
// capture the default method that is created instead of the original method
// it seems that the order of the method variants is switched depending on whether or not
// concrete asts are requested.
doTestForTwoTypeReferences(FIRST_CONTENTS_CLASS, secondContents, false, 1);
}

private void doTestForTwoInClassWithImplements(String secondContents) throws Exception {
doTestForTwoTypeReferences(FIRST_CONTENTS_INTERFACE, secondContents, false, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-SymbolicName: org.eclipse.jdt.groovy.core.tests.compiler;singleton:=true
Bundle-Name: Compiler Tests
Bundle-Vendor: Codehaus.org
Bundle-Version: 3.0.0.qualifier
Bundle-Version: 3.1.0.qualifier
Export-Package: org.eclipse.jdt.groovy.core.tests,
org.eclipse.jdt.groovy.core.tests.basic,
org.eclipse.jdt.groovy.core.tests.xform
Require-Bundle: org.codehaus.groovy;bundle-version="[2.4.15,3)";visibility:=reexport,
org.eclipse.core.resources;bundle-version="[3.12.0,4.0.0)";visibility:=reexport,
org.eclipse.core.runtime;bundle-version="[3.13.0,4.0.0)";visibility:=reexport,
org.eclipse.jdt.core;bundle-version="[3.13.0,4.0.0)";visibility:=reexport,
org.eclipse.core.resources;bundle-version="[3.12.0,4)";visibility:=reexport,
org.eclipse.core.runtime;bundle-version="[3.13.0,4)";visibility:=reexport,
org.eclipse.jdt.core;bundle-version="[3.13.0,4)";visibility:=reexport,
org.eclipse.jdt.core.tests.compiler;visibility:=reexport,
org.eclipse.jdt.groovy.core;visibility:=reexport,
org.junit;bundle-version="[4.12.0,5)";visibility:=reexport
Expand Down
4 changes: 2 additions & 2 deletions base-test/org.eclipse.jdt.groovy.core.tests.compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<relativePath>../../pom.xml</relativePath>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.eclipse.jdt.groovy.core.tests.compiler</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.codehaus.groovy.eclipse.compilerResolver;singleton:=true
Bundle-Name: Groovy Compiler Resolver
Bundle-Vendor: Codehaus.org
Bundle-Version: 3.0.0.qualifier
Bundle-Version: 3.1.0.qualifier
Export-Package: org.codehaus.groovy.eclipse.chooser,
org.codehaus.groovy.frameworkadapter.util
Require-Bundle: org.eclipse.core.runtime
Expand Down
4 changes: 2 additions & 2 deletions base/org.codehaus.groovy.eclipse.compilerResolver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<relativePath>../../pom.xml</relativePath>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.compilerResolver</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy24/.checkstyle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<file-match-pattern match-pattern="groovy/ast/ClassNode.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/CodeVisitorSupport.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/CompileUnit.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/ConstructorNode.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/GenericsType.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/GroovyCodeVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/ast/ImportNode.java" include-pattern="false" />
Expand Down Expand Up @@ -64,7 +65,6 @@
<file-match-pattern match-pattern="groovy/transform/stc/StaticTypeCheckingVisitor.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/transform/trait/TraitASTTransformation.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/vmplugin/v5/Java5.java" include-pattern="false" />
<file-match-pattern match-pattern="groovy/vmplugin/v8/Java8.java" include-pattern="false" />
</fileset>
<filter name="DerivedFiles" enabled="true" />
</fileset-config>
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy24/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
</classpathentry>

<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
</classpath>
13 changes: 3 additions & 10 deletions base/org.codehaus.groovy24/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand All @@ -20,7 +19,6 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
Expand Down Expand Up @@ -52,7 +50,6 @@ org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
Expand All @@ -61,16 +58,12 @@ org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
Expand All @@ -92,6 +85,6 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy24/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ Require-Bundle: org.eclipse.core.runtime,
org.junit;resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.codehaus.groovy.activator.GroovyActivator
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-BundleShape: dir
2 changes: 1 addition & 1 deletion base/org.codehaus.groovy24/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<relativePath>../../pom.xml</relativePath>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy.eclipse.parent</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.groovy.eclipse</groupId>
<artifactId>org.codehaus.groovy</artifactId>
Expand Down
Loading

0 comments on commit f630f2a

Please sign in to comment.