matyb / java-koans

A framework and lessons to learn java syntax and idioms in a logical sequence.
Apache License 2.0
733 stars 494 forks source link

AboutEquality updated but not being read through correctly #11

Closed pbattisson closed 13 years ago

pbattisson commented 13 years ago

Getting continual error on line 26 expected but was :.

Code on Line 26 of About Equality

@Koan 
public void noObjectShouldbeEqualToNull() {
    assertEquals(new Object().equals(null),false);
}

Running on Mac 10.7: java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)

matyb commented 13 years ago

i am on it. i will look into this when i get out of work. thanks for sharing, it sould be resolved soon.

matyb commented 13 years ago

mis clicked on comment and close :)

matyb commented 13 years ago

My apologies pbattisson, I'm trying to follow and having a bit of trouble forgive me :)

tldr; I recommend:

We can rule out java, but perhaps your behind on an OS update? Here's what I'm running to attempt reproducing:

werd-mbp:src matyb$ sw_vers & java -version
ProductName: Mac OS X
ProductVersion: 10.7.1
BuildVersion: 11B26
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)

I tried running just the AboutEquality suite: ./run.sh intermediate.AboutEquality

and: ./run.sh

both ran through the AboutEquality suite (fix + save in sequence, like a normal person running through the koans) without issue.

Please respond if that helps, and if not, respond anyway :P I'd like to know if the line# and method name and code are 100% accurate, or if I'm missing any details.

PS - the program output is like an old teletype app, it uses line breaks to clear console. you can paste the entire playback into here (or in an email if it's too long).

Cheers, Mat

pbattisson commented 13 years ago

Okay tried all of those other than deleting everything and it fails still:

Ponder what's going wrong in the AboutEquality class's noObjectShouldbeEqualToNull method.

Line 26 may offer a clue as to how you may progress, now make haste!

What went wrong: expected: but was:

Level: Intermediate Progress: [XXXXXXXXXXX---------------------------------------] 2/9 Remaining Suites: AboutEquality

Edit & save a koan to reload or enter 'Q' to exit


The code on line 26 is 
@Koan 
public void noObjectShouldbeEqualToNull() {
    assertEquals(new Object().equals(null),false);
}

Will try doing the full reload at some point over the weekend. You have exactly the same Mac setup as me, which makes it weirder.

Thanks for your help

Paul
pbattisson commented 13 years ago

I fact, just tried deleting that test and reloading the system and it doesn't recognise the test has gone. Curiouser ad curiouser....

matyb commented 13 years ago

pbattisson, thanks for being patient. I think you may have deleted the source file and not the class. If your source contains the same code and you deleted the class file, you would see very different output.

Without the class file the system will recompile it. It works correctly when i copy and paste your code, so if it compiles with that code that's guarenteed to be what the app evaluates. Make sure your deleting the class file from the bin directory. If your using an ide you may have more than one copy of the class, so get rid of the one the app is using.

Let me know if that helps.

pbattisson commented 13 years ago

Nope, still nothing. Next time I get a chance I am going to download the entire thing again and start fromt he beginning again.

Should be on Wednesday so let you know,

matyb commented 13 years ago

hmmmm I'm convinced your not deleting the class. The app compiles it and runs the koan methods in it. If you did it would have compiled a new copy with your corrected code, or provided an exception. If you deleted it, there would be no way for the app to know what it used to be.

If your having trouble finding the class file in koans/bin, then copy your koans/src directory over a new install. If you still have this problem then I guarantee the problem is with the src file and in that case you can copy over it from the archive you got off github.

pbattisson commented 13 years ago

[javac, -d, /Users/paulbattisson/Documents/Learning/java-koans/koans/bin, -classpath, /Users/paulbattisson/Documents/Learning/java-koans/koans/lib/koans.jar, /Users/paulbattisson/Documents/Learning/java-koans/koans/src/intermediate/AboutEquality.java] /Users/paulbattisson/Documents/Learning/java-koans/koans/src/intermediate/AboutEquality.java does not compile. exit status was: 1


java.io.FileNotFoundException: /Users/paulbattisson/Documents/Learning/java-koans/koans/bin/intermediate/AboutEquality.class (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:120) at java.io.FileInputStream.(FileInputStream.java:79) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at com.sandwich.util.io.DynamicClassLoader.loadClass(DynamicClassLoader.java:97) at com.sandwich.util.io.DynamicClassLoader.loadClass(DynamicClassLoader.java:74) at com.sandwich.koan.runner.RunKoans.constructSuite(RunKoans.java:115) at com.sandwich.koan.runner.RunKoans.runKoans(RunKoans.java:56) at com.sandwich.koan.runner.RunKoans.run(RunKoans.java:41) at com.sandwich.koan.constant.ArgumentType.run(ArgumentType.java:73) at com.sandwich.koan.cmdline.CommandLineArgument.run(CommandLineArgument.java:36) at com.sandwich.koan.cmdline.CommandLineArgumentRunner.run(CommandLineArgumentRunner.java:26) at com.sandwich.koan.runner.AppLauncher.main(AppLauncher.java:18) Exception in thread "main" java.lang.RuntimeException: java.lang.ClassFormatError: Truncated class file at com.sandwich.koan.constant.ArgumentType.run(ArgumentType.java:80) at com.sandwich.koan.cmdline.CommandLineArgument.run(CommandLineArgument.java:36) at com.sandwich.koan.cmdline.CommandLineArgumentRunner.run(CommandLineArgumentRunner.java:26) at com.sandwich.koan.runner.AppLauncher.main(AppLauncher.java:18) Caused by: java.lang.ClassFormatError: Truncated class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.lang.ClassLoader.defineClass(ClassLoader.java:465) at com.sandwich.util.io.DynamicClassLoader.loadClass(DynamicClassLoader.java:109) at com.sandwich.util.io.DynamicClassLoader.loadClass(DynamicClassLoader.java:74) at com.sandwich.koan.runner.RunKoans.constructSuite(RunKoans.java:115) at com.sandwich.koan.runner.RunKoans.runKoans(RunKoans.java:56) at com.sandwich.koan.runner.RunKoans.run(RunKoans.java:41) at com.sandwich.koan.constant.ArgumentType.run(ArgumentType.java:73) ... 3 more

matyb commented 13 years ago

Awesome! Thats progress definitely. It looks like the AboutEquality java file has an error keeping it from compiling, replace the java file and rerun, it should work fine then.

Let me know.

pbattisson commented 13 years ago

Yeah! Working like a treat, thanks for the help :-)