From 7a7e3bee4e5ea38b634b8b645759a53e0ef0ea52 Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Wed, 30 Oct 2024 10:22:14 +0100 Subject: [PATCH] remove no longer needed reflections --- .../tests/builder/BuildAffectionTest.xtend | 205 +++------- .../ide/tests/builder/BuildAffectionTest.java | 361 ++++++------------ .../xtext/builder/impl/Bug486584Test.java | 5 +- .../xtext/builder/impl/XtextBuilder.java | 49 +-- ...ourceInstallingCompilationParticipant.java | 86 +---- .../WorkspaceProjectsStateTest.java | 16 +- ...XtextBrowserInformationControlAdapter.java | 16 +- 7 files changed, 189 insertions(+), 549 deletions(-) diff --git a/org.eclipse.xtend.ide.tests/longrunning/src/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.xtend b/org.eclipse.xtend.ide.tests/longrunning/src/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.xtend index 4df606837e2..c0ac0c83bdd 100644 --- a/org.eclipse.xtend.ide.tests/longrunning/src/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.xtend +++ b/org.eclipse.xtend.ide.tests/longrunning/src/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.xtend @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2022 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2014, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -33,7 +33,6 @@ import org.junit.Test import static org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil.* import static extension org.eclipse.xtext.util.Strings.* import static org.junit.Assert.* -import org.osgi.framework.Version /** * @author Jan Koehnlein - Initial contribution and API @@ -487,33 +486,18 @@ class BuildAffectionTest { int foo; } ''') - if (isCoreResourceGreaterOrEqual_3_17_0) { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } else { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } + assertBuildLogs(''' + Building test.project + indexing platform:/resource/test.project/src/Foo.xtend + Built test.project in \d+ ms + Building test.project + Built test.project in \d+ ms + Building test.client + indexing platform:/resource/test.client/src/Client.xtend + Built test.client in \d+ ms + Building test.client + Built test.client in \d+ ms + ''') } @Test @@ -530,33 +514,17 @@ class BuildAffectionTest { protected int foo; } ''') - if (isCoreResourceGreaterOrEqual_3_17_0) { - assertBuildLogs(''' - Building test.project - Built test.project in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } else { - assertBuildLogs(''' - Building test.project - Built test.project in \d+ ms - Building test.client - Built test.client in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } + assertBuildLogs(''' + Building test.project + Built test.project in \d+ ms + Building test.project + Built test.project in \d+ ms + Building test.client + indexing platform:/resource/test.client/src/Client.xtend + Built test.client in \d+ ms + Building test.client + Built test.client in \d+ ms + ''') } @Test @@ -577,33 +545,17 @@ class BuildAffectionTest { protected int foo; } ''') - if (isCoreResourceGreaterOrEqual_3_17_0) { - assertBuildLogs(''' - Building test.project - Built test.project in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } else { - assertBuildLogs(''' - Building test.project - Built test.project in \d+ ms - Building test.client - Built test.client in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } + assertBuildLogs(''' + Building test.project + Built test.project in \d+ ms + Building test.project + Built test.project in \d+ ms + Building test.client + indexing platform:/resource/test.client/src/Client.xtend + Built test.client in \d+ ms + Building test.client + Built test.client in \d+ ms + ''') } @Test @@ -640,33 +592,18 @@ class BuildAffectionTest { } } ''') - if (isCoreResourceGreaterOrEqual_3_17_0) { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } else { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } + assertBuildLogs(''' + Building test.project + indexing platform:/resource/test.project/src/Foo.xtend + Built test.project in \d+ ms + Building test.project + Built test.project in \d+ ms + Building test.client + indexing platform:/resource/test.client/src/Client.xtend + Built test.client in \d+ ms + Building test.client + Built test.client in \d+ ms + ''') } @Test @@ -700,35 +637,19 @@ class BuildAffectionTest { } } ''') - if (isCoreResourceGreaterOrEqual_3_17_0) { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Bar.xtend - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } else { - assertBuildLogs(''' - Building test.project - indexing platform:/resource/test.project/src/Bar.xtend - indexing platform:/resource/test.project/src/Foo.xtend - Built test.project in \d+ ms - Building test.client - indexing platform:/resource/test.client/src/Client.xtend - Built test.client in \d+ ms - Building test.project - Built test.project in \d+ ms - Building test.client - Built test.client in \d+ ms - ''') - } + assertBuildLogs(''' + Building test.project + indexing platform:/resource/test.project/src/Bar.xtend + indexing platform:/resource/test.project/src/Foo.xtend + Built test.project in \d+ ms + Building test.project + Built test.project in \d+ ms + Building test.client + indexing platform:/resource/test.client/src/Client.xtend + Built test.client in \d+ ms + Building test.client + Built test.client in \d+ ms + ''') } private def assertBuildLogs(CharSequence expected) { @@ -754,10 +675,4 @@ class BuildAffectionTest { createFile(new Path('test.client/src/' + name + '.xtend'), content.toString) } - def private static boolean isCoreResourceGreaterOrEqual_3_17_0() { - var version_3_17_0 = new Version(3,17,0) - var installed = ResourcesPlugin.getPlugin().getBundle().getVersion() - return installed >= version_3_17_0 - } - } \ No newline at end of file diff --git a/org.eclipse.xtend.ide.tests/xtend-gen/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.java b/org.eclipse.xtend.ide.tests/xtend-gen/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.java index 7083f0c01c1..cfce6e30dbc 100644 --- a/org.eclipse.xtend.ide.tests/xtend-gen/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.java +++ b/org.eclipse.xtend.ide.tests/xtend-gen/org/eclipse/xtend/ide/tests/builder/BuildAffectionTest.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2014, 2022 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2014, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -37,7 +37,6 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.osgi.framework.Version; /** * @author Jan Koehnlein - Initial contribution and API @@ -751,54 +750,28 @@ public void testAffected_dependentProject() { _builder_2.append("}"); _builder_2.newLine(); this.changeContent(foo, _builder_2); - boolean _isCoreResourceGreaterOrEqual_3_17_0 = BuildAffectionTest.isCoreResourceGreaterOrEqual_3_17_0(); - if (_isCoreResourceGreaterOrEqual_3_17_0) { - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - this.assertBuildLogs(_builder_3); - } else { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - this.assertBuildLogs(_builder_4); - } + StringConcatenation _builder_3 = new StringConcatenation(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.project/src/Foo.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + this.assertBuildLogs(_builder_3); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -825,54 +798,26 @@ public void testAffected_dependentProject_Java() { _builder_2.append("}"); _builder_2.newLine(); this.changeContent(foo, _builder_2); - boolean _isCoreResourceGreaterOrEqual_3_17_0 = BuildAffectionTest.isCoreResourceGreaterOrEqual_3_17_0(); - if (_isCoreResourceGreaterOrEqual_3_17_0) { - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - this.assertBuildLogs(_builder_3); - } else { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - this.assertBuildLogs(_builder_4); - } + StringConcatenation _builder_3 = new StringConcatenation(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + this.assertBuildLogs(_builder_3); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -910,54 +855,26 @@ public void testAffected_dependentProject_Java_WithExpression() { _builder_2.append("}"); _builder_2.newLine(); this.changeContent(foo, _builder_2); - boolean _isCoreResourceGreaterOrEqual_3_17_0 = BuildAffectionTest.isCoreResourceGreaterOrEqual_3_17_0(); - if (_isCoreResourceGreaterOrEqual_3_17_0) { - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - this.assertBuildLogs(_builder_3); - } else { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - this.assertBuildLogs(_builder_4); - } + StringConcatenation _builder_3 = new StringConcatenation(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + this.assertBuildLogs(_builder_3); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -1024,54 +941,28 @@ public void testAffected_annotationProcessorChanged_singleFile() { _builder_2.append("}"); _builder_2.newLine(); this.changeContent(foo, _builder_2); - boolean _isCoreResourceGreaterOrEqual_3_17_0 = BuildAffectionTest.isCoreResourceGreaterOrEqual_3_17_0(); - if (_isCoreResourceGreaterOrEqual_3_17_0) { - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.project"); - _builder_3.newLine(); - _builder_3.append("Built test.project in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - _builder_3.append("Building test.client"); - _builder_3.newLine(); - _builder_3.append("Built test.client in \\d+ ms"); - _builder_3.newLine(); - this.assertBuildLogs(_builder_3); - } else { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - this.assertBuildLogs(_builder_4); - } + StringConcatenation _builder_3 = new StringConcatenation(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.project/src/Foo.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.project"); + _builder_3.newLine(); + _builder_3.append("Built test.project in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("indexing platform:/resource/test.client/src/Client.xtend"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + _builder_3.append("Building test.client"); + _builder_3.newLine(); + _builder_3.append("Built test.client in \\d+ ms"); + _builder_3.newLine(); + this.assertBuildLogs(_builder_3); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -1131,58 +1022,30 @@ public void testAffected_annotationProcessorChanged_separateFiles() { _builder_3.append("}"); _builder_3.newLine(); this.changeContent(bar, _builder_3); - boolean _isCoreResourceGreaterOrEqual_3_17_0 = BuildAffectionTest.isCoreResourceGreaterOrEqual_3_17_0(); - if (_isCoreResourceGreaterOrEqual_3_17_0) { - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.project/src/Bar.xtend"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.project"); - _builder_4.newLine(); - _builder_4.append("Built test.project in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - _builder_4.append("Building test.client"); - _builder_4.newLine(); - _builder_4.append("Built test.client in \\d+ ms"); - _builder_4.newLine(); - this.assertBuildLogs(_builder_4); - } else { - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("Building test.project"); - _builder_5.newLine(); - _builder_5.append("indexing platform:/resource/test.project/src/Bar.xtend"); - _builder_5.newLine(); - _builder_5.append("indexing platform:/resource/test.project/src/Foo.xtend"); - _builder_5.newLine(); - _builder_5.append("Built test.project in \\d+ ms"); - _builder_5.newLine(); - _builder_5.append("Building test.client"); - _builder_5.newLine(); - _builder_5.append("indexing platform:/resource/test.client/src/Client.xtend"); - _builder_5.newLine(); - _builder_5.append("Built test.client in \\d+ ms"); - _builder_5.newLine(); - _builder_5.append("Building test.project"); - _builder_5.newLine(); - _builder_5.append("Built test.project in \\d+ ms"); - _builder_5.newLine(); - _builder_5.append("Building test.client"); - _builder_5.newLine(); - _builder_5.append("Built test.client in \\d+ ms"); - _builder_5.newLine(); - this.assertBuildLogs(_builder_5); - } + StringConcatenation _builder_4 = new StringConcatenation(); + _builder_4.append("Building test.project"); + _builder_4.newLine(); + _builder_4.append("indexing platform:/resource/test.project/src/Bar.xtend"); + _builder_4.newLine(); + _builder_4.append("indexing platform:/resource/test.project/src/Foo.xtend"); + _builder_4.newLine(); + _builder_4.append("Built test.project in \\d+ ms"); + _builder_4.newLine(); + _builder_4.append("Building test.project"); + _builder_4.newLine(); + _builder_4.append("Built test.project in \\d+ ms"); + _builder_4.newLine(); + _builder_4.append("Building test.client"); + _builder_4.newLine(); + _builder_4.append("indexing platform:/resource/test.client/src/Client.xtend"); + _builder_4.newLine(); + _builder_4.append("Built test.client in \\d+ ms"); + _builder_4.newLine(); + _builder_4.append("Building test.client"); + _builder_4.newLine(); + _builder_4.append("Built test.client in \\d+ ms"); + _builder_4.newLine(); + this.assertBuildLogs(_builder_4); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } @@ -1232,10 +1095,4 @@ private IFile createClientProjectFile(final String name, final CharSequence cont throw Exceptions.sneakyThrow(_e); } } - - private static boolean isCoreResourceGreaterOrEqual_3_17_0() { - Version version_3_17_0 = new Version(3, 17, 0); - Version installed = ResourcesPlugin.getPlugin().getBundle().getVersion(); - return (installed.compareTo(version_3_17_0) >= 0); - } } diff --git a/org.eclipse.xtext.builder.tests/src/org/eclipse/xtext/builder/impl/Bug486584Test.java b/org.eclipse.xtext.builder.tests/src/org/eclipse/xtext/builder/impl/Bug486584Test.java index 3fb77beea68..2a7e1d4b0d8 100644 --- a/org.eclipse.xtext.builder.tests/src/org/eclipse/xtext/builder/impl/Bug486584Test.java +++ b/org.eclipse.xtext.builder.tests/src/org/eclipse/xtext/builder/impl/Bug486584Test.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2016, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -10,7 +10,6 @@ import static org.eclipse.xtext.builder.impl.BuilderUtil.*; import static org.junit.Assert.*; -import static org.junit.Assume.*; import java.io.File; import java.io.IOException; @@ -35,7 +34,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.osgi.framework.Version; import com.google.common.collect.ImmutableList; @@ -136,7 +134,6 @@ public void testNoFullBuildIfJavadocChangeOnly() throws CoreException, Interrupt @Test public void testFullBuildWhenTestAttributeChanges() throws Exception { - assumeTrue(JavaCore.getPlugin().getBundle().getVersion().compareTo(new Version(3,33,0)) >= 0); IJavaProject project = setupProject(); // create src2 folder and give it a separate output folder addSourceFolder(project, SRC2_FOLDER); diff --git a/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/impl/XtextBuilder.java b/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/impl/XtextBuilder.java index af0ad36cde7..3e8b84137a9 100644 --- a/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/impl/XtextBuilder.java +++ b/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/impl/XtextBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2022 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2009, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -9,9 +9,7 @@ package org.eclipse.xtext.builder.impl; import java.lang.reflect.Field; -import java.lang.reflect.Method; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; @@ -23,7 +21,6 @@ import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.resources.IStorage; import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; @@ -52,7 +49,6 @@ import org.eclipse.xtext.ui.shared.contribution.ISharedStateContributionRegistry; import org.eclipse.xtext.util.internal.Stopwatches; import org.eclipse.xtext.util.internal.Stopwatches.StoppedTask; -import org.osgi.framework.Version; import com.google.common.annotations.Beta; import com.google.common.collect.ImmutableList; @@ -68,8 +64,6 @@ */ public class XtextBuilder extends IncrementalProjectBuilder { - private static final Version VERSION_3_17_0 = new Version(3,17,0); - private static final Logger log = Logger.getLogger(XtextBuilder.class); public static final String BUILDER_ID = XtextProjectHelper.BUILDER_ID; @@ -636,11 +630,7 @@ protected void clean(IProgressMonitor monitor) throws CoreException { @Deprecated private static boolean wasDeprecationWarningLoggedForClean = false; - private Method requestProjectRebuildMethod; - private Method requestProjectsRebuildMethod; - private static Version installedCoreResourcesVersion; - protected void addInfosFromTaskAndClean(ToBeBuilt toBeBuilt, Task task, IProgressMonitor monitor) throws CoreException { addInfosFromTask(task, toBeBuilt); if (XtextBuilder.class.equals(getClass())) { @@ -770,17 +760,10 @@ public ISchedulingRule getRule(int kind, Map args) { * @since 2.27 */ public void triggerRequestProjectRebuild() { - if (requestProjectRebuildMethod != null || isCoreResourceGreaterOrEqual(VERSION_3_17_0)) { - try { - if (requestProjectRebuildMethod == null) { - requestProjectRebuildMethod = getClass().getMethod("requestProjectRebuild", Boolean.TYPE); - } - requestProjectRebuildMethod.invoke(this, true); - } catch (Exception e) { - log.error("something went wrong in triggerRequestProjectRebuild", e); - needRebuild(); - } - } else { + try { + requestProjectRebuild(true); + } catch (Exception e) { + log.error("something went wrong in triggerRequestProjectRebuild", e); needRebuild(); } } @@ -789,28 +772,14 @@ public void triggerRequestProjectRebuild() { * @since 2.27 */ public void triggerRequestProjectsRebuild(IProject project) { - if (requestProjectsRebuildMethod != null || isCoreResourceGreaterOrEqual(VERSION_3_17_0)) { - try { - if (requestProjectsRebuildMethod == null) { - requestProjectsRebuildMethod = getClass().getMethod("requestProjectsRebuild", Collection.class); - } - requestProjectsRebuildMethod.invoke(this, Collections.singletonList(project)); - } catch (Exception e) { - log.error("something went wrong in triggerRequestProjectRebuild", e); - needRebuild(); - } - } else { + try { + requestProjectsRebuild(Collections.singletonList(project)); + } catch (Exception e) { + log.error("something went wrong in triggerRequestProjectRebuild", e); needRebuild(); } } - private static boolean isCoreResourceGreaterOrEqual(Version version) { - if (installedCoreResourcesVersion == null) { - installedCoreResourcesVersion = ResourcesPlugin.getPlugin().getBundle().getVersion(); - } - return installedCoreResourcesVersion.compareTo(version) >= 0; - } - /** * @since 2.32 */ diff --git a/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/smap/DebugSourceInstallingCompilationParticipant.java b/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/smap/DebugSourceInstallingCompilationParticipant.java index c4c3d6cebd2..9469f9420ee 100644 --- a/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/smap/DebugSourceInstallingCompilationParticipant.java +++ b/org.eclipse.xtext.builder/src/org/eclipse/xtext/builder/smap/DebugSourceInstallingCompilationParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2023 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2012, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -9,8 +9,6 @@ package org.eclipse.xtext.builder.smap; import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.Set; @@ -44,7 +42,6 @@ import org.eclipse.xtext.ui.util.ResourceUtil; import org.eclipse.xtext.util.internal.Stopwatches; import org.eclipse.xtext.util.internal.Stopwatches.StoppedTask; -import org.osgi.framework.Version; import com.google.common.collect.Lists; import com.google.common.io.ByteStreams; @@ -58,11 +55,6 @@ public class DebugSourceInstallingCompilationParticipant extends CompilationParticipant implements CompilationParticipantExtension { private static final Logger log = Logger.getLogger(DebugSourceInstallingCompilationParticipant.class); - private static final Version VERSION_3_34_0 = new Version(3, 34, 0); - - private static Version installedJdtCoreVersion; - - private List files; @Inject private IResourceServiceProvider.Registry serviceProviderRegistry; @@ -120,9 +112,6 @@ protected ITraceToBytecodeInstaller getInstaller(OutputConfiguration config) { @Override public Optional postProcess(BuildContext ctx, ByteArrayInputStream bytes) { Optional no_change = Optional.empty(); - if (!isJdtCoreGreaterOrEqual(VERSION_3_34_0)) { - return no_change; - } try { IFile generatedJavaFile = ctx.getFile(); @@ -170,64 +159,9 @@ public void buildFinished(IJavaProject project) { try { task.start(); super.buildFinished(project); - if (isJdtCoreGreaterOrEqual(VERSION_3_34_0)) { - // nothing to do here - return; - } else { - if (files == null) - return; - for (BuildContext ctx : files) { - try { - IFile generatedJavaFile = ctx.getFile(); - - // This may fail if there is no trace file. - IEclipseTrace traceToSource = traceInformation.getTraceToSource(generatedJavaFile); - if (traceToSource == null) { - continue; - } - AbstractTraceRegion rootTraceRegion = findRootTraceRegion(traceToSource); - if (rootTraceRegion == null) - continue; - - SourceRelativeURI dslSourceFile = rootTraceRegion.getAssociatedSrcRelativePath(); - - // OutputConfigurations are only available for folders targeted by Xtext's code generation. - OutputConfiguration outputConfiguration = findOutputConfiguration(dslSourceFile, generatedJavaFile); - if (outputConfiguration == null) - continue; - - IJavaElement element = JavaCore.create(generatedJavaFile); - if (element == null) - continue; - - deleteTaskMarkers(generatedJavaFile); - markerReflector.reflectErrorMarkerInSource(generatedJavaFile, traceToSource); - - ITraceToBytecodeInstaller installer = getInstaller(outputConfiguration); - installer.setTrace(generatedJavaFile.getName(), rootTraceRegion); - for (IFile javaClassFile : findGeneratedJavaClassFiles(element)) { - InputStream contents = javaClassFile.getContents(); - try { - byte[] byteCode = installer.installTrace(ByteStreams.toByteArray(contents)); - if (byteCode != null) { - javaClassFile.setContents(new ByteArrayInputStream(byteCode), 0, null); - } else { - // we need to touch the class file to do a respin of the build - // otherwise a needsRebuild request is ignored since no IResourceDelta is available - javaClassFile.touch(null); - } - } finally { - contents.close(); - } - } - } catch (Exception e) { - String msg = "Could not process %s to install source information: %s"; - log.error(String.format(msg, ctx.getFile().getFullPath().toString(), e.getMessage()), e); - } - } - } + // nothing to do here + return; } finally { - files = null; task.stop(); } } @@ -242,13 +176,6 @@ protected void deleteTaskMarkers(IFile generatedJavaFile) throws CoreException { @Override public void buildStarting(BuildContext[] files, boolean isBatch) { super.buildStarting(files, isBatch); - if (!isJdtCoreGreaterOrEqual(VERSION_3_34_0)) { - if (this.files != null) { - this.files.addAll(Arrays.asList(files)); - } else { - this.files = Lists.newArrayList(files); - } - } } protected List findGeneratedJavaClassFiles(IJavaElement element) { @@ -272,11 +199,4 @@ public boolean isActive(IJavaProject project) { return XtextProjectHelper.hasNature(project.getProject()); } - private static boolean isJdtCoreGreaterOrEqual(Version version) { - if (installedJdtCoreVersion == null) { - installedJdtCoreVersion = JavaCore.getPlugin().getBundle().getVersion(); - } - return installedJdtCoreVersion.compareTo(version) >= 0; - } - } diff --git a/org.eclipse.xtext.ui.tests/tests/org/eclipse/xtext/ui/tests/scoping/namespaces/WorkspaceProjectsStateTest.java b/org.eclipse.xtext.ui.tests/tests/org/eclipse/xtext/ui/tests/scoping/namespaces/WorkspaceProjectsStateTest.java index e8ee87cb36e..35b049633fb 100644 --- a/org.eclipse.xtext.ui.tests/tests/org/eclipse/xtext/ui/tests/scoping/namespaces/WorkspaceProjectsStateTest.java +++ b/org.eclipse.xtext.ui.tests/tests/org/eclipse/xtext/ui/tests/scoping/namespaces/WorkspaceProjectsStateTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2009, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -23,7 +23,6 @@ import org.eclipse.xtext.ui.resource.Storage2UriMapperImpl; import org.eclipse.xtext.ui.resource.UriValidator; import org.junit.Test; -import org.osgi.framework.Version; /** * @author Sebastian Zarnekow - Initial contribution and API @@ -104,17 +103,17 @@ public boolean isPossiblyManaged(IStorage storage) { @Test public void testGetContainedURIs_01() { Collection containedURIs = projectsState.getContainedURIs(project1.getName()); - assertEquals(containedURIs.toString(), isCoreResourceGreaterOrEqual_3_17_0() ? 3 : 2, containedURIs.size()); + assertEquals(containedURIs.toString(), 3, containedURIs.size()); assertTrue(containedURIs.contains(uri1)); assertTrue(containedURIs.contains(uri2)); } @Test public void testGetContainedURIs_02() throws CoreException, InvocationTargetException, InterruptedException { Collection containedURIs = projectsState.getContainedURIs(project1.getName()); - assertEquals(containedURIs.toString(), isCoreResourceGreaterOrEqual_3_17_0() ? 3 : 2, containedURIs.size()); + assertEquals(containedURIs.toString(), 3, containedURIs.size()); URI uri = createFileAndRegisterResource(project1, "file3"); containedURIs = projectsState.getContainedURIs(project1.getName()); - assertEquals(containedURIs.toString(), isCoreResourceGreaterOrEqual_3_17_0() ? 4 : 3, containedURIs.size()); + assertEquals(containedURIs.toString(), 4, containedURIs.size()); assertTrue(containedURIs.contains(uri1)); assertTrue(containedURIs.contains(uri2)); assertTrue(containedURIs.contains(uri)); @@ -123,15 +122,10 @@ public boolean isPossiblyManaged(IStorage storage) { @Override @Test public void testRemoveNature() throws CoreException { Collection containedURIs = projectsState.getContainedURIs(project1.getName()); - assertEquals(isCoreResourceGreaterOrEqual_3_17_0() ? 3 : 2, containedURIs.size()); + assertEquals(3, containedURIs.size()); IResourcesSetupUtil.removeNature(project1, XtextProjectHelper.NATURE_ID); containedURIs = projectsState.getContainedURIs(project1.getName()); assertTrue(containedURIs.isEmpty()); } - private static boolean isCoreResourceGreaterOrEqual_3_17_0() { - Version installedCoreResourcesVersion = ResourcesPlugin.getPlugin().getBundle().getVersion(); - return installedCoreResourcesVersion.compareTo(new Version(3,17,0)) >= 0; - } - } diff --git a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/hover/html/XtextBrowserInformationControlAdapter.java b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/hover/html/XtextBrowserInformationControlAdapter.java index 1bb1f7bf439..49abb71385f 100644 --- a/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/hover/html/XtextBrowserInformationControlAdapter.java +++ b/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/hover/html/XtextBrowserInformationControlAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2023 itemis AG (http://www.itemis.eu) and others. + * Copyright (c) 2012, 2024 itemis AG (http://www.itemis.eu) and others. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. @@ -8,10 +8,8 @@ *******************************************************************************/ package org.eclipse.xtext.ui.editor.hover.html; -import java.lang.reflect.Method; import org.apache.log4j.Logger; -import org.eclipse.core.runtime.Platform; import org.eclipse.jface.internal.text.html.BrowserInformationControl; import org.eclipse.jface.internal.text.html.BrowserInformationControlInput; import org.eclipse.jface.text.IInputChangedListener; @@ -20,7 +18,6 @@ import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; -import org.osgi.framework.Version; /** * @author Sebastian Zarnekow - Initial contribution and API @@ -149,16 +146,7 @@ public void addInputChangeListener(IInputChangedListener inputChangeListener) { @Override public void setDisposeTimeout(int disposeTimeout) { - try { - Method m = BrowserInformationControl.class.getDeclaredMethod("setDisposeTimeout", int.class); - m.invoke(control, disposeTimeout); - } catch (ReflectiveOperationException e) { - if (Platform.getBundle("org.eclipse.jface.text").getVersion().compareTo(new Version(3,24,0)) >= 0) { - LOG.error("Unexpected reflection failure", e); - } else { - // OK, method not there in older versions - } - } + control.setDisposeTimeout(disposeTimeout); } } \ No newline at end of file