Last active
November 25, 2015 14:48
-
-
Save tam7t/b952d76ca9531f04678c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DoesNotWork { | |
public static void main(String[] args) { | |
// this will compile once, fail on execution, and subsequent compiles fail | |
Messages.Status me = Messages.Status.newBuilder().buildPartial(); | |
System.out.println("It Works!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum STATUS { | |
OK = 1; | |
} | |
message Status { | |
required STATUS code = 1; | |
} | |
message Person { | |
required string name = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "protobuf + java = 💩" | |
echo "-----java info-----" | |
java -version | |
echo "-----protobuf info-----" | |
protoc --version | |
printf "\n\n" | |
read -rsp $'Press any key to download protobuf jar...\n' -n1 key | |
wget http://central.maven.org/maven2/com/google/protobuf/protobuf-java/2.6.1/protobuf-java-2.6.1.jar | |
read -rsp $'Press any key to compile messages.proto...\n' -n1 key | |
protoc --proto_path . --java_out . messages.proto | |
read -rsp $'Press any key to compile the working example...\n' -n1 key | |
javac Works.java -cp protobuf-java-2.6.1.jar:. | |
read -rsp $'Press any key to run the working example...\n' -n1 key | |
java -cp protobuf-java-2.6.1.jar:. Works | |
read -rsp $'Press any key to clear compiled classes...\n' -n1 key | |
rm *.class | |
read -rsp $'Press any key to compile the non-working example...\n' -n1 key | |
javac DoesNotWork.java -cp protobuf-java-2.6.1.jar:. | |
read -rsp $'Press any key to run the non-working example...\n' -n1 key | |
java -cp protobuf-java-2.6.1.jar:. DoesNotWork | |
read -rsp $'Press any key to compile the non-working example...\n' -n1 key | |
javac DoesNotWork.java -cp protobuf-java-2.6.1.jar:. | |
echo "Clean up files with $ rm Messages.java *.class protobuf-java-2.6.1.jar" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Works { | |
public static void main(String[] args) { | |
// this will work all day every day | |
Messages.Person me = Messages.Person.newBuilder().buildPartial(); | |
System.out.println("It Works!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This demonstrates a failure on OSX Oracle JVM 1.8: