1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Moved to JDK 1.8.

Change-Id: I415625d3cebe3ff38454bd6722c31da07eb466c4
This commit is contained in:
Sergey Prigogin 2015-12-27 21:39:00 -08:00
parent 744765be6f
commit 00e7081b17
4 changed files with 251 additions and 265 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <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.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

View file

@ -1,7 +1,7 @@
#Fri Apr 25 15:22:29 EDT 2008
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@ -62,4 +62,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8

View file

@ -12,4 +12,4 @@ Require-Bundle: org.eclipse.core.runtime,
Export-Package: org.eclipse.cdt.core.lrparser.tests Export-Package: org.eclipse.cdt.core.lrparser.tests
Bundle-Vendor: %Bundle-Vendor.0 Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.8

View file

@ -15,9 +15,6 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode; import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
@ -28,6 +25,8 @@ import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.lrparser.gnu.GCCLanguage; import org.eclipse.cdt.core.dom.lrparser.gnu.GCCLanguage;
import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ILanguage;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/** /**
* Reuse the completion parse tests from the old parser for now. * Reuse the completion parse tests from the old parser for now.
@ -39,16 +38,17 @@ public class LRCompletionParseTest extends TestCase {
return new TestSuite(LRCompletionParseTest.class); return new TestSuite(LRCompletionParseTest.class);
} }
public LRCompletionParseTest() {
}
public LRCompletionParseTest() { } public LRCompletionParseTest(String name) {
public LRCompletionParseTest(String name) { super(name); } super(name);
}
protected IASTCompletionNode parse(String code, int offset) throws Exception { protected IASTCompletionNode parse(String code, int offset) throws Exception {
return ParseHelper.getCompletionNode(code, getCLanguage(), offset); return ParseHelper.getCompletionNode(code, getCLanguage(), offset);
} }
private static final Comparator<IBinding> BINDING_COMPARATOR = new Comparator<IBinding>() { private static final Comparator<IBinding> BINDING_COMPARATOR = new Comparator<IBinding>() {
@Override @Override
public int compare(IBinding b1, IBinding b2) { public int compare(IBinding b1, IBinding b2) {
@ -56,31 +56,28 @@ public class LRCompletionParseTest extends TestCase {
} }
}; };
public static IBinding[] getBindings(IASTName[] names) { public static IBinding[] getBindings(IASTName[] names) {
List<IBinding> bindings = new ArrayList<IBinding>(); List<IBinding> bindings = new ArrayList<>();
for (IASTName name : names) { for (IASTName name : names) {
if (name.getTranslationUnit() == null) if (name.getTranslationUnit() == null)
continue; continue;
for(IBinding binding : name.getCompletionContext().findBindings(name, true)) for (IBinding binding : name.getCompletionContext().findBindings(name, true)) {
bindings.add(binding); bindings.add(binding);
} }
}
Collections.sort(bindings, BINDING_COMPARATOR); Collections.sort(bindings, BINDING_COMPARATOR);
return bindings.toArray(new IBinding[bindings.size()]); return bindings.toArray(new IBinding[bindings.size()]);
} }
protected ILanguage getCLanguage() { protected ILanguage getCLanguage() {
return GCCLanguage.getDefault(); return GCCLanguage.getDefault();
} }
// First steal tests from CompletionParseTest // First steal tests from CompletionParseTest
public void testCompletionStructField() throws Exception { public void testCompletionStructField() throws Exception {
String code = String code =
"int aVar; " + "int aVar; " +
@ -135,7 +132,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("nWidth", ((IField)bindings[2]).getName()); assertEquals("nWidth", ((IField)bindings[2]).getName());
} }
public void testCompletionParametersAsLocalVariables() throws Exception{ public void testCompletionParametersAsLocalVariables() throws Exception{
String code = String code =
"int foo(int aParameter) {" + "int foo(int aParameter) {" +
@ -162,7 +158,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("aParameter", ((IVariable) bindings[2]).getName()); assertEquals("aParameter", ((IVariable) bindings[2]).getName());
} }
public void testCompletionTypedef() throws Exception { public void testCompletionTypedef() throws Exception {
String code = String code =
"typedef int Int; " + "typedef int Int; " +
@ -226,7 +221,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("name", ((IField) bindings[0]).getName()); assertEquals("name", ((IField) bindings[0]).getName());
} }
public void _testCompletionFunctionCall() throws Exception { public void _testCompletionFunctionCall() throws Exception {
String code = String code =
"struct A { \n" + "struct A { \n" +
@ -253,7 +247,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("f4", ((IField) bindings[1]).getName()); assertEquals("f4", ((IField) bindings[1]).getName());
} }
public void _testCompletionSizeof() throws Exception { public void _testCompletionSizeof() throws Exception {
String code = String code =
"int f() {\n" + "int f() {\n" +
@ -274,7 +267,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("blah", ((IVariable) bindings[0]).getName()); assertEquals("blah", ((IVariable) bindings[0]).getName());
} }
public void testCompletionForLoop() throws Exception { public void testCompletionForLoop() throws Exception {
String code = String code =
"int f() {\n" + "int f() {\n" +
@ -295,8 +287,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("biSizeImage", ((IVariable) bindings[0]).getName()); assertEquals("biSizeImage", ((IVariable) bindings[0]).getName());
} }
public void testCompletionStructPointer() throws Exception { public void testCompletionStructPointer() throws Exception {
String code = String code =
" struct Temp { char * total; };" + " struct Temp { char * total; };" +
@ -317,7 +307,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("total", ((IVariable) bindings[0]).getName()); assertEquals("total", ((IVariable) bindings[0]).getName());
} }
public void testCompletionEnum() throws Exception { public void testCompletionEnum() throws Exception {
String code = String code =
"typedef int DWORD;\n" + "typedef int DWORD;\n" +
@ -348,7 +337,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("blah3", ((IEnumerator) bindings[2]).getName()); assertEquals("blah3", ((IEnumerator) bindings[2]).getName());
} }
public void testCompletionStructArray() throws Exception { public void testCompletionStructArray() throws Exception {
String code = String code =
"struct packet { int a; int b; };\n" + "struct packet { int a; int b; };\n" +
@ -371,7 +359,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("b", ((IField) bindings[1]).getName()); assertEquals("b", ((IField) bindings[1]).getName());
} }
public void testCompletionPreprocessorDirective() throws Exception { public void testCompletionPreprocessorDirective() throws Exception {
IASTCompletionNode node = parse("#", 1); IASTCompletionNode node = parse("#", 1);
assertNotNull(node); assertNotNull(node);
@ -399,7 +386,6 @@ public class LRCompletionParseTest extends TestCase {
assertEquals("A", node.getPrefix()); assertEquals("A", node.getPrefix());
} }
public void testCompletionInsidePreprocessorDirective() throws Exception { public void testCompletionInsidePreprocessorDirective() throws Exception {
String code = String code =
"#define MAC1 99 \n" + "#define MAC1 99 \n" +