hoijui / JavaOSC

OSC content format/"protocol" library for JVM languages
http://www.illposed.com/software/javaosc.html
BSD 3-Clause "New" or "Revised" License
156 stars 43 forks source link

mvn compile errors #31

Closed lobsteroh closed 5 years ago

lobsteroh commented 7 years ago

hi all, am running into some problems with the basic mvn install ... osx 10.11.6 and java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

 [java] The following errors occurred during analysis:
 [java]   Unable to get XClass for java/lang/StringBuilder
 [java]     java.lang.ArrayIndexOutOfBoundsException: 5747
 [java]       At org.objectweb.asm.ClassReader.readClass(Unknown Source)
 [java]       At org.objectweb.asm.ClassReader.accept(Unknown Source)
 [java]       At edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44)
 [java]       At org.objectweb.asm.ClassReader.accept(Unknown Source)
 ....

and finally

 [INFO] ------------------------------------------------------------------------
 [INFO] Reactor Summary:
 [INFO] 
 [INFO] JavaOSC - Parent ................................... SUCCESS [  0.092 s]
 [INFO] JavaOSC - Core ..................................... FAILURE [  7.900 s]
 [INFO] JavaOSC - UI ....................................... SKIPPED
 [INFO] JavaOSC - Aggregation .............................. SKIPPED
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------

any suggestions greatly welcome

hoijui commented 7 years ago

hey lob! :-) ... awww i spent soo much time making sure it compiles with Java 6, and apparently i forgot to check Java 8 compatibility in the end. :/ i am sorry! i just tested (on the javaosc-0.4 release), and it compiles with Java 6 and 7, but not 8. i think i will not change it anymore, but will soon make a new release 0.5, with many updates already in line. for now, you should be able to work around this with:

Workaround

in the file modules/core/pom.xml, starting from line 83 (in javaosc-0.4), remove the whole section <executions>...</executions>, and then run mvn install again. you will not loose anything by that, just some tests are not run.

lobsteroh commented 7 years ago

hi hoijui, thanx a huge bunch for your msg. i just ended up loading the folder into eclipse and compiling it there. actually i have been just importing the source files for my own compiles and everything worked out like a charm. just got into osc and am puzzled by how good this system is. kicking myself why i haven't used it earlier. thanks again, robert

hoijui commented 7 years ago

ahhh good! :-) yeah... i never, really actually used OSC in practise. i made an out-interface for a real time strategy game engine, where i exported statistics in rela time over OSC, which then could be used to generate live music dependent on what would be going on on the battlefield. there was a music artist interested in using it, he said, but he never did anythign, and i am not talented in music to do anything myself. what do you use it for? music or robotics or something else?

btw, i just released a SNAPSHOT of soon-to-come version 0.5. (it is from the development branch, which is often rebased)

PS: i am swiss-german. living in berlin

2017-03-27 22:32 GMT+02:00, Robert Huber notifications@github.com:

hi hoijui, thanx a huge bunch for your msg. i just ended up loading the folder into eclipse and compiling it there. actually i have been just importing the source files for my own compiles and everything worked out like a charm. just got into osc and am puzzled by how good this system is. kicking myself why i haven't used it earlier. thanks again, robert

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/hoijui/JavaOSC/issues/31#issuecomment-289576945

lobsteroh commented 7 years ago

hallo freut mich ungemein, bin Oesterreicher und lebe in den USA :-) I really appreciate your library, saved my bacon. i was using it to play sound in PureData for a series of site-specific acousmatic compositions and I was controlling it from a java-based videotracking application. it would have been very difficult to do this dynamic soundscape without your library. i had never used OSC before (or had even heard of it), but I can see its power and i will use it for many future projects from sensor logging to controlling robotic interfaces. the library is very elegant, beautifully abstracted and i managed to get it working even without much knowledge of the protocol. my favorite object is OSCPortOut - was my friend on first sight. only thing that took me a while was realizing that the 'address' in osc message was not referring to a hostname ... smooth sailing after. Vielen Dank noch einmal.

hoijui commented 7 years ago

:D ahh wow.. danke fuer die blumen! :-) obwohl die lib urspruenglich nicht von mir designed wurde, hab ich da schon viel geaendert, und mittlerweile sicher viel mehr daran gemacht als der urspruengliche author. und das ist eine gute info bezueglich der OSC address... das ist versaendlich, dass man das eher so interpretiert. meinst du es haette was gebracht, wenn ddas im class doc beschrieben waehre? oder haettest du da eh nicht nachgelesen? werd ich so oder so noch machen jetzt. na dann... viel erfolg und spass mit deinen werken!

2017-03-29 8:56 GMT+02:00, Robert Huber notifications@github.com:

hallo freut mich ungemein, bin Oesterreicher und lebe in den USA :-) I really appreciate your library, saved my bacon. i was using it to play sound in PureData for a series of site-specific acousmatic compositions that I was controlling from a java-based videotracking application. it would have been very difficult to do this dynamic soundscape without your library. i had never used OSC before (or had even heard about it), but I can see the power and will use it for many new projects from sensor logging to controlling robotic interfaces. the library is very elegant, beautifully abstracted and i managed to get it working even without much knowledge of the protocol. my favorite object is OSCPortOut - was my friend on first sight. only thing that took me a while was realizing that the 'address' in osc message was not referring to a hostname ... smooth sailing after. Vielen Dank noch einmal.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/hoijui/JavaOSC/issues/31#issuecomment-290000487

lobsteroh commented 7 years ago

i began working through it via the examples/tutorial. a comment there in the line for OSCMessage construction would have been the path to the correct read for me. thanks again.

hoijui commented 7 years ago

ahh... where did you find that? i would not know where that is.. ;-) on a website maybe, or old version repo?

lobsteroh commented 7 years ago

i found several

https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwiNqumvqfvSAhVKM5oKHS9zAVYQFggjMAA&url=http%3A%2F%2Fwww.programcreek.com%2Fjava-api-examples%2Findex.php%3Fapi%3Dcom.illposed.osc.OSCMessage&usg=AFQjCNHXv0td4TyV5uhq1Y_16y8pdBJdqA&bvm=bv.150729734,d.bGs

<https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0ahUKEwiNqumvqfvSAhVKM5oKHS9zAVYQFggpMAE&url=http%3A%2F%2Fwww.illposed.com%2Fsoftware%2Fjavaosc.html&usg=AFQjCNHkqH-6Y2F9tDfi1oqKfpaH8Uldlg&bvm=bv.150729734,d.bGs >

https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0ahUKEwiNqumvqfvSAhVKM5oKHS9zAVYQFggvMAI&url=http%3A%2F%2Fwww.javased.com%2F%3Fapi%3Dcom.illposed.osc.OSCMessage&usg=AFQjCNFbh0H7Tha9cLmzd_1KqVeIV7l6-g

https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=5&ved=0ahUKEwiNqumvqfvSAhVKM5oKHS9zAVYQFgg6MAQ&url=https%3A%2F%2Fgithub.com%2Fmkalten%2FTUIO11_JAVA%2Fblob%2Fmaster%2Fsrc%2Fcom%2Fillposed%2Fosc%2FOSCPortOut.java&usg=AFQjCNGoDApbJWKFJg2ECEyWV5MGAjHI1w

hoijui commented 7 years ago

i see... yeah, nothing about the usage of OSCPort there, so no wonder you start searching elsewhere for putting the receiver IP. can't do much about that unfortunately, but will improve javadoc comments in the source. thanks! :-)

dsouth commented 7 years ago

Your workaround removes the one error, but there are test failure.

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.illposed.osc.OSCBundleTest
[ERROR] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.076 s <<< FAILURE! - in com.illposed.osc.OSCBundleTest
[ERROR] testSendBundle(com.illposed.osc.OSCBundleTest)  Time elapsed: 0.013 s  <<< FAILURE!
java.lang.AssertionError: Send Bundle did not receive the correct timestamp Thu Jan 01 10:00:00 EST 1970(0) (should be Thu Jun 22 12:58:08 EST 2017( 1498100288850)) 
    at com.illposed.osc.OSCBundleTest.sendBundleTimestampTestHelper(OSCBundleTest.java:30)
    at com.illposed.osc.OSCBundleTest.testSendBundle(OSCBundleTest.java:47)

[INFO] Running com.illposed.osc.OSCMessageTest
[INFO] Tests run: 36, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 s - in com.illposed.osc.OSCMessageTest
[INFO] Running com.illposed.osc.OSCPortTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.648 s - in com.illposed.osc.OSCPortTest
[INFO] Running com.illposed.osc.utility.OSCByteArrayToJavaConverterTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in com.illposed.osc.utility.OSCByteArrayToJavaConverterTest
[INFO] Running com.illposed.osc.utility.OSCJavaToByteArrayConverterTest
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in com.illposed.osc.utility.OSCJavaToByteArrayConverterTest
[INFO] Running com.illposed.osc.utility.OSCPacketDispatcherTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in com.illposed.osc.utility.OSCPacketDispatcherTest
[INFO] Running com.illposed.osc.utility.OSCPatternAddressSelectorTest
[INFO] Tests run: 29, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in com.illposed.osc.utility.OSCPatternAddressSelectorTest
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   OSCBundleTest.testSendBundle:47->sendBundleTimestampTestHelper:30 Send Bundle did not receive the correct timestamp Thu Jan 01 10:00:00 EST 1970(0) (should be Thu Jun 22 12:58:08 EST 2017( 1498100288850)) 
[INFO] 
[ERROR] Tests run: 97, Failures: 1, Errors: 0, Skipped: 0
hoijui commented 7 years ago

what works for me:

get latest repo status:

git fetch
# or
git clone https://github.com/hoijui/JavaOSC.git
cd JavaOSC

then:

mvn clean

and finally:

git checkout javaosc-0.4-java8fix
mvn install

this works for me with Java 8 on linux, including the unit tests. did you try some other version? does this fail for you too?

lobsteroh commented 7 years ago

confirming it works like a charm on mac osx as well. thanks for doing this. a few minor heads-ups like [WARNING] bootstrap class path not set in conjunction with -source 1.6 but clean compile and tests without failures. tx

hoijui commented 7 years ago

ook, nice! :-) thanks for letting me know. yeah, those warnings will be there until we switch source and target to Java 8, but they are only really relevant when compiling for a release.

daveyarwood commented 5 years ago

I just got bit by the same thing as in the original post, running Java 8 on the develop branch. Merging the java8 branch fixed the "Unable to get XClass for ..." errors, but findbugs still found one bug, causing mvn clean install to fail:

[INFO] --- findbugs-maven-plugin:3.0.5:check (default) @ javaosc-core ---
[INFO] BugInstance size is 1
[INFO] Error size is 0
[INFO] Total bugs: 1
[INFO] Class com.illposed.osc.OSCMessageEvent defines non-transient non-serializable instance field message [com.illposed.osc.OSCMessageEvent] In OSCMessageEvent.java SE_BAD_FIELD

The issue here is that we have a class OSCMessageEvent that is supposed to be Serializable (by way of extending java.util.EventObject), however it has a private final OSCMessage message property, and OSCMessage does not implement Serializable. If I'm understanding correctly, this is a problem because it means things will blow up us soon as somebody attempts to serialize an OSCMessageEvent.

This StackOverflow question is relevant here. I'm not quite sure how best to handle this. It feels like we just need to implement Serializable for OSCMessage, like we've done for other classes.

I'm about to submit a PR that merges java8 into develop and also fixes checkstyle violations -- hopefully that's a step in the right direction!

daveyarwood commented 5 years ago

BTW, I found that changing this line:

private final OSCMessage message;

to

private final transient OSCMessage message;

also fixes the bug and allows mvn install to run successfully, but that's probably not desirable because it means the message field will not be serialized. I would think that if somebody wants to serialize an OSCMessageEvent, they'll probably want the message to be part of it!

hoijui commented 5 years ago

ouhh yeah the OSCMessage should probably be serializable! But java8 should not yet be merged into develop, because we are still on Java 7 regarding compatibility and release version target.

daveyarwood commented 5 years ago

That makes sense. Do you know what, exactly about the java8 branch is not compatible with Java 7? It would be great if we could go ahead and push toward compatibility with both Java 7 and 8.

hoijui commented 5 years ago

I think that is only possible with two different code-bases, or at least two different artifacts (like javaosc-0.5.0-java6and7 and javaosc-0.5.0-java8+, because the class-file format has changed in Java 8. If I remember right, that is the fundamental issue. Common practice to deal with this is to just change to the newer versions of Java at a new release... sometime. I find it a bit strange, because one never knows with which Java version a library is compiled.. that is not something that Maven has mechanisms for, for example. So... at some point I would release a new version with Java 7, then very son move to Java 8, maybe even immediately, and make an other release right away. I guess In the Java world, there is generally little reason not to update a system to a new JRE version, because there are few restrictions on the underlying OS in most cases. In the very worst case, someone being limited to Java 6 or 7, they would have to use an older release of the library, opr manually make some changes and compile it themselves.

daveyarwood commented 5 years ago

Ah, that all makes sense.

If your goal is to release some unreleased code and have it be available for Java 6-7, then I think it makes sense to release JavaOSC 0.5.0 as the last release that supports Java 6-7, then immediately release JavaOSC 0.6.0 as the first release that requires Java 8+.

FWIW, Java 7 reached EOL back in January 2015, so I don't think there is a compelling reason to continue to support it. Everybody should be using Java 8+ at this point, for critical security updates, etc.

hoijui commented 5 years ago

wow... makes me feel old! ;-) you are right of course, and thanks for the info.

hoijui commented 5 years ago

the develop branch now uses Java 8, and so will the nest release.