Skip to content

Commit

Permalink
Upgrade to Xtext 2.19, LSP4J 0.8.0 and fix LSP server
Browse files Browse the repository at this point in the history
Every connection to the LSP server failed because it always threw a org.eclipse.smarthome.model.ide.SitemapIdeSetup NoClassDefFoundError.
Which is caused by the SitemapIdeSetup residing in a package that is split between both the org.openhab.core.model.item.ide and the org.openhab.core.model.sitemap.ide bundles.
The SitemapIdeSetup class is also using classes from the org.eclipse.smarthome.model package which is also a package split between the org.openhab.core.model.items and org.openhab.core.model.sitemap bundles.
After renaming the packages used for the sitemap classes the NoClassDefFoundError is resolved and LSP works properly again.
Many imports were updated for the model sitemap model package changes.

Fixes openhab#1030

Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn committed Oct 29, 2019
1 parent 80dce80 commit 554ff2f
Show file tree
Hide file tree
Showing 47 changed files with 275 additions and 282 deletions.
4 changes: 2 additions & 2 deletions bom/compile-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<properties>
<emf.1.version>2.12.0</emf.1.version>
<emf.3.version>2.11.0</emf.3.version>
<emf.mwe.version>1.4.0</emf.mwe.version>
<emf.mwe2.version>2.10.0</emf.mwe2.version>
<emf.mwe.version>1.5.0</emf.mwe.version>
<emf.mwe2.version>2.11.0</emf.mwe2.version>
</properties>

<dependencies>
Expand Down
22 changes: 11 additions & 11 deletions bom/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
<version>27.1-jre</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -756,31 +756,31 @@
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib.macro</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.common.types</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.ide</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand All @@ -792,25 +792,25 @@
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.util</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.ide</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.lib</artifactId>
<version>2.17.0</version>
<version>2.19.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -858,7 +858,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.0</version>
<version>7.1</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import org.eclipse.smarthome.core.thing.ThingRegistry;
import org.eclipse.smarthome.core.thing.link.ItemChannelLinkRegistry;
import org.eclipse.smarthome.model.core.ModelRepositoryChangeListener;
import org.eclipse.smarthome.model.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.SitemapFactory;
import org.eclipse.smarthome.model.sitemap.SitemapProvider;
import org.eclipse.smarthome.model.sitemap.impl.DefaultImpl;
import org.eclipse.smarthome.model.sitemap.impl.FrameImpl;
import org.eclipse.smarthome.model.sitemap.impl.SitemapImpl;
import org.eclipse.smarthome.model.sitemap.impl.TextImpl;
import org.eclipse.smarthome.model.sitemap.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.sitemap.SitemapFactory;
import org.eclipse.smarthome.model.sitemap.sitemap.impl.DefaultImpl;
import org.eclipse.smarthome.model.sitemap.sitemap.impl.FrameImpl;
import org.eclipse.smarthome.model.sitemap.sitemap.impl.SitemapImpl;
import org.eclipse.smarthome.model.sitemap.sitemap.impl.TextImpl;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import org.eclipse.smarthome.io.rest.sitemap.internal.SitemapEvent;
import org.eclipse.smarthome.model.core.EventType;
import org.eclipse.smarthome.model.core.ModelRepositoryChangeListener;
import org.eclipse.smarthome.model.sitemap.LinkableWidget;
import org.eclipse.smarthome.model.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.SitemapProvider;
import org.eclipse.smarthome.model.sitemap.Widget;
import org.eclipse.smarthome.model.sitemap.sitemap.LinkableWidget;
import org.eclipse.smarthome.model.sitemap.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.sitemap.Widget;
import org.eclipse.smarthome.ui.items.ItemUIRegistry;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
import org.eclipse.smarthome.core.types.State;
import org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper;
import org.eclipse.smarthome.io.rest.sitemap.SitemapSubscriptionService.SitemapSubscriptionCallback;
import org.eclipse.smarthome.model.sitemap.Chart;
import org.eclipse.smarthome.model.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.Frame;
import org.eclipse.smarthome.model.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.Widget;
import org.eclipse.smarthome.model.sitemap.sitemap.Chart;
import org.eclipse.smarthome.model.sitemap.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.sitemap.Frame;
import org.eclipse.smarthome.model.sitemap.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.sitemap.Widget;
import org.eclipse.smarthome.ui.items.ItemUIRegistry;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@
import org.eclipse.smarthome.io.rest.core.item.EnrichedItemDTOMapper;
import org.eclipse.smarthome.io.rest.sitemap.SitemapSubscriptionService;
import org.eclipse.smarthome.io.rest.sitemap.SitemapSubscriptionService.SitemapSubscriptionCallback;
import org.eclipse.smarthome.model.sitemap.Chart;
import org.eclipse.smarthome.model.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.Frame;
import org.eclipse.smarthome.model.sitemap.Image;
import org.eclipse.smarthome.model.sitemap.LinkableWidget;
import org.eclipse.smarthome.model.sitemap.List;
import org.eclipse.smarthome.model.sitemap.Mapping;
import org.eclipse.smarthome.model.sitemap.Mapview;
import org.eclipse.smarthome.model.sitemap.Selection;
import org.eclipse.smarthome.model.sitemap.Setpoint;
import org.eclipse.smarthome.model.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.SitemapProvider;
import org.eclipse.smarthome.model.sitemap.Slider;
import org.eclipse.smarthome.model.sitemap.Switch;
import org.eclipse.smarthome.model.sitemap.Video;
import org.eclipse.smarthome.model.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.Webview;
import org.eclipse.smarthome.model.sitemap.Widget;
import org.eclipse.smarthome.model.sitemap.sitemap.Chart;
import org.eclipse.smarthome.model.sitemap.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.sitemap.Frame;
import org.eclipse.smarthome.model.sitemap.sitemap.Image;
import org.eclipse.smarthome.model.sitemap.sitemap.LinkableWidget;
import org.eclipse.smarthome.model.sitemap.sitemap.List;
import org.eclipse.smarthome.model.sitemap.sitemap.Mapping;
import org.eclipse.smarthome.model.sitemap.sitemap.Mapview;
import org.eclipse.smarthome.model.sitemap.sitemap.Selection;
import org.eclipse.smarthome.model.sitemap.sitemap.Setpoint;
import org.eclipse.smarthome.model.sitemap.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.sitemap.Slider;
import org.eclipse.smarthome.model.sitemap.sitemap.Switch;
import org.eclipse.smarthome.model.sitemap.sitemap.Video;
import org.eclipse.smarthome.model.sitemap.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.sitemap.Webview;
import org.eclipse.smarthome.model.sitemap.sitemap.Widget;
import org.eclipse.smarthome.ui.items.ItemUIRegistry;
import org.glassfish.jersey.media.sse.EventOutput;
import org.glassfish.jersey.media.sse.OutboundEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.types.State;
import org.eclipse.smarthome.io.rest.LocaleService;
import org.eclipse.smarthome.model.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.SitemapProvider;
import org.eclipse.smarthome.model.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.Widget;
import org.eclipse.smarthome.model.sitemap.sitemap.ColorArray;
import org.eclipse.smarthome.model.sitemap.sitemap.Sitemap;
import org.eclipse.smarthome.model.sitemap.sitemap.VisibilityRule;
import org.eclipse.smarthome.model.sitemap.sitemap.Widget;
import org.eclipse.smarthome.test.java.JavaTest;
import org.eclipse.smarthome.ui.items.ItemUIRegistry;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.smarthome.model.ide.ItemsIdeSetup;
import org.eclipse.smarthome.model.ide.SitemapIdeSetup;
import org.eclipse.smarthome.model.persistence.ide.PersistenceIdeSetup;
import org.eclipse.smarthome.model.rule.ide.RulesIdeSetup;
import org.eclipse.smarthome.model.script.ScriptServiceUtil;
import org.eclipse.smarthome.model.script.engine.ScriptEngine;
import org.eclipse.smarthome.model.script.ide.ScriptIdeSetup;
import org.eclipse.smarthome.model.sitemap.ide.SitemapIdeSetup;
import org.eclipse.smarthome.model.thing.ide.ThingIdeSetup;
import org.eclipse.xtext.XtextPackage;
import org.eclipse.xtext.resource.FileExtensionProvider;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* generated by Xtext 2.19.0
*/
package org.eclipse.smarthome.model.sitemap.ide


/**
* Use this class to register ide components.
*/
class SitemapIdeModule extends AbstractSitemapIdeModule {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* generated by Xtext 2.19.0
*/
package org.eclipse.smarthome.model.sitemap.ide

import com.google.inject.Guice
import org.eclipse.smarthome.model.sitemap.SitemapRuntimeModule
import org.eclipse.smarthome.model.sitemap.SitemapStandaloneSetup
import org.eclipse.xtext.util.Modules2

/**
* Initialization support for running Xtext languages as language servers.
*/
class SitemapIdeSetup extends SitemapStandaloneSetup {

override createInjector() {
Guice.createInjector(Modules2.mixin(new SitemapRuntimeModule, new SitemapIdeModule))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*/
package org.eclipse.smarthome.model.sitemap.runtime.internal;

import org.eclipse.smarthome.model.SitemapStandaloneSetup;
import org.eclipse.smarthome.model.core.ModelParser;
import org.eclipse.smarthome.model.sitemap.SitemapStandaloneSetup;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
24 changes: 12 additions & 12 deletions bundles/org.openhab.core.model.sitemap/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Bundle-SymbolicName: ${project.artifactId}
Export-Package: org.eclipse.smarthome.model,\
org.eclipse.smarthome.model.formatting,\
org.eclipse.smarthome.model.generator,\
org.eclipse.smarthome.model.parser.antlr,\
org.eclipse.smarthome.model.parser.antlr.internal,\
org.eclipse.smarthome.model.scoping,\
org.eclipse.smarthome.model.serializer,\
org.eclipse.smarthome.model.services,\
org.eclipse.smarthome.model.sitemap,\
org.eclipse.smarthome.model.sitemap.impl,\
org.eclipse.smarthome.model.sitemap.util,\
org.eclipse.smarthome.model.validation
Export-Package: org.eclipse.smarthome.model.sitemap,\
org.eclipse.smarthome.model.sitemap.formatting,\
org.eclipse.smarthome.model.sitemap.generator,\
org.eclipse.smarthome.model.sitemap.parser.antlr,\
org.eclipse.smarthome.model.sitemap.parser.antlr.internal,\
org.eclipse.smarthome.model.sitemap.scoping,\
org.eclipse.smarthome.model.sitemap.serializer,\
org.eclipse.smarthome.model.sitemap.services,\
org.eclipse.smarthome.model.sitemap.sitemap,\
org.eclipse.smarthome.model.sitemap.sitemap.impl,\
org.eclipse.smarthome.model.sitemap.sitemap.util,\
org.eclipse.smarthome.model.sitemap.validation
Import-Package: org.apache.commons.lang,\
org.apache.log4j,\
org.eclipse.jdt.annotation;resolution:=optional,\
Expand Down
4 changes: 2 additions & 2 deletions bundles/org.openhab.core.model.sitemap/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.eclipse.org/smarthome/model/Sitemap"
class = "org.eclipse.smarthome.model.sitemap.SitemapPackage"
uri = "http://www.eclipse.org/smarthome/model/sitemap/Sitemap"
class = "org.eclipse.smarthome.model.sitemap.sitemap.SitemapPackage"
genModel = "model/generated/Sitemap.genmodel" />

</extension>
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.openhab.core.model.sitemap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
<arguments>
<argument>file://${project.basedir}/src/org/eclipse/smarthome/model/GenerateSitemap.mwe2</argument>
<argument>file://${project.basedir}/src/org/eclipse/smarthome/model/sitemap/GenerateSitemap.mwe2</argument>
<argument>-p</argument>
<argument>rootPath=/${project.basedir}/..</argument>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*
* SPDX-License-Identifier: EPL-2.0
*/
module org.eclipse.smarthome.model.GenerateSitemap
module org.eclipse.smarthome.model.sitemap.GenerateSitemap

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."
var projectName = "org.openhab.core.model.sitemap"
var languageName = "org.eclipse.smarthome.model.Sitemap"
var languageName = "org.eclipse.smarthome.model.sitemap.Sitemap"
var fileExtensions = "sitemap"
var generateXtendStub = true
var encoding = "UTF-8"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
grammarURI=classpath:/org/openhab/model/Sitemap.xtext
grammarURI=classpath:/org/openhab/model/sitemap/Sitemap.xtext
file.extensions=sitemap
projectName=org.eclipse.smarthome.model.sitemap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
grammar org.eclipse.smarthome.model.Sitemap with org.eclipse.xtext.common.Terminals
grammar org.eclipse.smarthome.model.sitemap.Sitemap with org.eclipse.xtext.common.Terminals

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate sitemap "http://www.eclipse.org/smarthome/model/Sitemap"
Expand Down
Loading

0 comments on commit 554ff2f

Please sign in to comment.