Skip to content

Commit

Permalink
Eclipse 4.16 (M2) JDT Patch for Groovy-Eclipse: JDT commit 57460b9
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed May 9, 2020
1 parent 9723670 commit d5e654f
Show file tree
Hide file tree
Showing 77 changed files with 2,443 additions and 1,032 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2019 the original author or authors.
* Copyright 2009-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -71,7 +71,11 @@ final class TriggerCharacterCompletionTests extends CompletionTestSuite {
@Test
void testTriggerForMethodProposals() {
String contents = '[].sort'; int offset = contents.length()
setJavaPreference(AssistOptions.OPTION_SubstringMatch, 'disabled')
try {
setJavaPreference(AssistOptions.OPTION_SubstringMatch, 'disabled')
} catch (MissingPropertyException e) {
System.setProperty(AssistOptions.PROPERTY_SubstringMatch, 'false')
}
ICompletionProposal[] proposals = orderByRelevance(createProposalsAtOffset(contents, offset))
/* expecting:
sort(Comparator c) : void - List
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</license>

<requires>
<import feature="org.eclipse.jdt" version="3.18.400.v20200409-0200" patch="true"/>
<import feature="org.eclipse.jdt" version="3.18.400.v20200501-0520" patch="true"/>
</requires>

<plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*******************************************************************************
* Copyright (c) 2020 Stephan Herrmann and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Stephan Herrmann - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.builder;

import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

import junit.framework.Test;

public class Bug562420Test extends BuilderTests {
public Bug562420Test(String name) {
super(name);
}

public static Test suite() {
return buildTestSuite(Bug562420Test.class);
}
public void testBuilderRegression() throws JavaModelException, Exception {
IPath projectPath = env.addProject("Bug562420Test", "9");
env.removePackageFragmentRoot(projectPath, "");
IPath src = env.addPackageFragmentRoot(projectPath, "src");

env.addExternalJars(projectPath, Util.getJavaClassLibs());
IPath testAppPath = env.addClass(src, "org.easylibs.test", "TestApp",
"package org.easylibs.test;\n" +
"public class TestApp {\n" +
" public static void main(String[] args) {\n" +
" System.out.println(\"Hello World\");\n" +
" }\n" +
"}\n");
env.addFile(testAppPath.removeLastSegments(1), "package-info.java",
"package org.easylibs.test;");
env.addFile(src, "module-info.java",
"module test {\n" +
" requires java.base;\n" +
" exports org.easylibs.test;\n" +
"}\n");
fullBuild();
if (CompilerOptions.versionToJdkLevel(System.getProperty("java.specification.version")) < ClassFileConstants.JDK9) {
expectingProblemsFor(projectPath,
"Problem : java.base cannot be resolved to a module [ resource : </Bug562420Test/src/module-info.java> range : <24,33> category : <160> severity : <2>]");
} else {
expectingNoProblems();
}

env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_SOURCE, "1.8");
env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, "1.8");
fullBuild();
expectingProblemsFor(projectPath,
"Problem : Syntax error on token \".\", , expected [ resource : </Bug562420Test/src/module-info.java> range : <28,29> category : <20> severity : <2>]\n" +
"Problem : Syntax error on token \".\", = expected [ resource : </Bug562420Test/src/module-info.java> range : <47,48> category : <20> severity : <2>]\n" +
"Problem : Syntax error on token \"module\", interface expected [ resource : </Bug562420Test/src/module-info.java> range : <0,6> category : <20> severity : <2>]");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ private static Class[] getAllTestClasses() {
Bug531382Test.class,
Bug549457Test.class,
Bug561287Test.class,
Bug562420Test.class,
LeakTestsBefore9.class,
};
List<Class<?>> list = new ArrayList<>(Arrays.asList(classes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ public void test0041() {
);
}
//TODO: Enable after Bug 552769 is fixed
public void _test0042() {
public void test0042() {
String[] testFiles = new String[] {
"X.java",
"void ___eval() {\n" +
Expand Down Expand Up @@ -2035,28 +2035,23 @@ public void _test0042() {
"Syntax error, insert \"EnumBody\" to complete CompilationUnit\n" +
"----------\n";

String expected_Java14_ProblemLog =
String expectedJ14ProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
" void ___eval() {\n" +
" ^^^^\n" +
"Syntax error on token \"void\", record expected\n" +
"----------\n" +
"2. ERROR in X.java (at line 1)\n" +
" void ___eval() {\n" +
" ^\n" +
"Syntax error on token \")\", { expected after this token\n" +
"----------\n" +
"3. ERROR in X.java (at line 23)\n" +
" }\n" +
" ^\n" +
"Syntax error, insert \"}\" to complete RecordBody\n" +
"2. ERROR in X.java (at line 2)\n" +
" new Runnable() {\n" +
" ^^^\n" +
"Syntax error on token \"new\", record expected\n" +
"----------\n";
runComplianceParserTest(
testFiles,
expected_Java14_ProblemLog,
expected_Java14_ProblemLog,
expected_Java14_ProblemLog
expected13ProblemLog,
expected14ProblemLog,
(this.complianceLevel < ClassFileConstants.JDK14 ? expected15ProblemLog : expectedJ14ProblemLog)
);
}
/*
Expand Down Expand Up @@ -2492,6 +2487,19 @@ public void test0052() {
expected13ProblemLog;

String expected15ProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
" void foo2() {\n" +
" ^^^^\n" +
"Syntax error on token \"void\", new expected\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" }\n" +
" ^\n" +
"Syntax error, insert \";\" to complete Statement\n" +
"----------\n";

String expectedJ14ProblemLog =
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
" void foo2() {\n" +
Expand All @@ -2503,7 +2511,7 @@ public void test0052() {
testFiles,
expected13ProblemLog,
expected14ProblemLog,
expected15ProblemLog
(this.complianceLevel < ClassFileConstants.JDK14 ? expected15ProblemLog : expectedJ14ProblemLog)
);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=42243
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,13 @@ public void test05() {
" }\n" +
" void foo() {\n" +
" System.out.println();\n" +
" void baz;\n" +
(this.complianceLevel < ClassFileConstants.JDK14
?
" new baz() {\n" +
" };\n"
:
" void baz;\n"
) +
" }\n" +
" void bar() {\n" +
" }\n" +
Expand Down Expand Up @@ -7042,7 +7048,18 @@ public void test117() {
" super();\n" +
" }\n" +
" }\n" +
" void foo2;\n" +
(this.complianceLevel < ClassFileConstants.JDK14
?
" new foo2() {\n" +
" };\n" +
" class Z<T> {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" }\n"
:
" void foo2;\n"
) +
" }\n" +
"}\n";

Expand Down Expand Up @@ -7121,7 +7138,18 @@ public void test117_2() {
" super();\n" +
" }\n" +
" }\n" +
" void foo2;\n" +
(this.complianceLevel < ClassFileConstants.JDK14
?
" new foo2() {\n" +
" };\n" +
" class Z {\n" +
" Z() {\n" +
" super();\n" +
" }\n" +
" }\n"
:
" void foo2;\n"
) +
" }\n" +
"}\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,13 @@ public void test0038() {
" }\n" +
" public void aMethod(int A) {\n" +
" public void anotherMethod;\n" +
(this.complianceLevel < ClassFileConstants.JDK14
?
" int A;\n" +
" ;\n"
:
""
) +
" }\n" +
" }\n" +
" public A() {\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,15 @@ public void test012(){
" -1.7 -7 -7.0 use 1.7 compliance (-source 1.7 -target 1.7)\n" +
" -1.8 -8 -8.0 use 1.8 compliance (-source 1.8 -target 1.8)\n" +
" -1.9 -9 -9.0 use 1.9 compliance (-source 1.9 -target 1.9)\n" +
" -source <version> set source level: 1.3 to 1.9 (or 6, 6.0, etc)\n" +
" -target <version> set classfile target: 1.1 to 1.9 (or 6, 6.0, etc)\n" +
" -10 -10.0 use 10 compliance (-source 10 -target 10)\n" +
" -11 -11.0 use 11 compliance (-source 11 -target 11)\n" +
" -12 -12.0 use 12 compliance (-source 12 -target 12)\n" +
" -13 -13.0 use 13 compliance (-source 13 -target 13)\n" +
" -14 -14.0 use 14 compliance (-source 14 -target 14)\n" +
" -source <version> set source level: 1.3 to 1.9, 10 to 14\n" +
" (or 6, 6.0, etc)\n" +
" -target <version> set classfile target: 1.3 to 1.9, 10 to 14\n" +
" (or 6, 6.0, etc)\n" +
" cldc1.1 can also be used to generate the StackMap\n" +
" attribute\n" +
" \n" +
Expand Down
Loading

0 comments on commit d5e654f

Please sign in to comment.