tobof / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
39 stars 30 forks source link

Unresolved compilation errors in current snapshot? #110

Closed kvoit closed 6 years ago

kvoit commented 6 years ago

I have installed http://www.oberfoell.com/openhab2/org.openhab.binding.mysensors-2.3.0-SNAPSHOT.jar as described in the installation instruction. However, I get an exception. My Java is pretty rusty, but to me it looks like the jar didn't compile properly:

2018-03-04 16:23:38.223 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@1d68c045': Unresolved compilation problems: 
        The type org.eclipse.jdt.annotation.Nullable cannot be resolved. It is indirectly referenced from required .class files
        The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files

java.lang.Error: Unresolved compilation problems: 
        The type org.eclipse.jdt.annotation.Nullable cannot be resolved. It is indirectly referenced from required .class files
        The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files

        at org.openhab.binding.mysensors.discovery.MySensorsDiscoveryService.<init>(MySensorsDiscoveryService.java:35) ~[?:?]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.registerDeviceDiscoveryService(MySensorsBridgeHandler.java:218) ~[?:?]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:86) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
2018-03-04 16:23:38.294 [WARN ] [rotocol.mqtt.MySensorsMqttConnection] - Skipping I_VERSION connection test, not recommended...
2018-03-04 16:23:38.320 [INFO ] [rotocol.mqtt.MySensorsMqttConnection] - Successfully connected to MySensors Bridge.
2018-03-04 16:23:38.313 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'mysensors:bridge-mqtt:gateway': Unresolved compilation problems: 
        The type org.eclipse.jdt.annotation.Nullable cannot be resolved. It is indirectly referenced from required .class files
        The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files

java.lang.Error: Unresolved compilation problems: 
        The type org.eclipse.jdt.annotation.Nullable cannot be resolved. It is indirectly referenced from required .class files
        The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files

        at org.openhab.binding.mysensors.discovery.MySensorsDiscoveryService.<init>(MySensorsDiscoveryService.java:35) ~[?:?]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.registerDeviceDiscoveryService(MySensorsBridgeHandler.java:218) ~[?:?]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:86) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
tobof commented 6 years ago

What is the version of OpenHAB2 you're running? Current Snapshot? Stable?

kvoit commented 6 years ago

Current stable apt version of openhab2:

2.2.0-1 500
        500 https://dl.bintray.com/openhab/apt-repo2 stable/main amd64 Packages

Thanks for looking into this.

wmarkow commented 6 years ago

I do not have such an error in my test environment. I'm using the latest stable openHAB-2.3.0 with the latest mysensor binding.

However, when I wanted to make some Java development on mysensor openHAB binding I have found something that may help to fix issue. Eclipse showed me the following error:

The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files

When building mysensors binding with Maven I have noticed the following warning message: [WARNING] .binding.mysensors.test\META-INF\MANIFEST.MF:[10] Every bundle should have optional Import-Package dependency to org.eclipse.jdt.annotation.

Then with help comes a e303975 commit by @freynder. The MANIFEST.MF file must contain the following line: org.eclipse.jdt.annotation;resolution:=optional,

After this change, Eclipse doesn't show the error anymore.

tobof commented 6 years ago

I've fixed the compilation error. It should now compile just fine.