kotlin-koans icon indicating copy to clipboard operation
kotlin-koans copied to clipboard

Compilation Failed

Open akki777-zz opened this issue 6 years ago • 15 comments

I am using Edu Tools - Kotlin Koans to learn Kotlin. The Compare with Answer in the Task Description window shows "Contents are identical". Still when I "Check Task" in the Task Description window, I get Compilation Failed.

This is happening in IntelliJ 2017.3.4 as well as Android Studio 3.1.2 . The "Lesson 1 - Task 1 (hello World.kt)" works fine. but afterwards this issue occurs. It says I have issues in other lessons like "Generics Task 1" and in tests file also.

akki777-zz avatar May 04 '18 15:05 akki777-zz

I just tried the EduTools JetBrains plugin on IntelliJ IDEA 2018.1.1 and it seems to work OK. However I find it critical to look at the unit tests as I work on the solution to the koan - and I don't see where you can get a view of the unit test in the plugin. I recommend pulling in the repo to a folder on your hard drive by:

File->New->Project from Version Control->Git and then download the Koans repo:

https://github.com/Kotlin/kotlin-koans

Then you can run the Junit tests in the Project kotlin-koans/test hierarchy as you do the work. Just right click on the tests (Windows) and run or debug them. The IDE gives you lots of useful feedback about type information, runtime library help, and links to the documentation. Don't forget the links to the documentation as pointed out in the 0 Hello World entry (click on doc reference and on Windows hit Control-Q). Also use "Control B" to pop to declarations and Control-Alt-leftArrow to pop back to your work. Enjoy!!

jimandreas avatar May 05 '18 10:05 jimandreas

I realised recently @haposik has also raised the same issue (with the screenshot). https://github.com/Kotlin/kotlin-koans/issues/148. Please look at this issue to get a clear view.

akki777-zz avatar May 06 '18 07:05 akki777-zz

You might try running the Junit test manually and look for details on the build errors.

Try switching to the Project Files view in the Project tool window, then navigate to lesson2 / task6 / lesson2-task6_test (the task shown by @haposik) or to your particular lesson. Then you can run the test manually as indicated in the screenshot below. The View / Tool Windows / { Messages and Build } windows might have hints about the compiler complaints.

koansmanually

To switch back to plug in mode, select "Course" in the project window.

jimandreas avatar May 07 '18 04:05 jimandreas

I find this as a bug..so this should be solved, instead of finding a workaround.

akki777-zz avatar May 08 '18 04:05 akki777-zz

What compiler errors are you seeing? This information should be in the View / Tool Windows / { Messages and Build } windows as you are seeing a compile errors. If you post your compile errors then the IntelliJ people will have clues about the problem.

jimandreas avatar May 08 '18 05:05 jimandreas

Following is the Error in Problems window. @jimandreas . And I have not touched this file. screen shot 2018-05-08 at 6 43 57 pm

This issue also has the screenshot -> https://github.com/Kotlin/kotlin-koans/issues/148

akki777-zz avatar May 08 '18 13:05 akki777-zz

The lesson6 / task1 problem (Generics) is the last problem in project. It doesn't compile until you get the whole solution right. I confess I had to peek at the solution. Spoiler - my modified solution is below - if you paste this solution over the top of the:

fun partitionTo() = TODO()

line in the problem - this should compile and solve the problem. The solution is quite tricky - the syntax has to be exactly correct before the compile errors disappear. TYP = type of items in the collections, and COLL = the "flavor" (HashSet or ArrayList in this case) of the collection.

fun <TYP, COLL: MutableCollection<TYP>> Collection<TYP>.partitionTo(
        list1: COLL, list2: COLL, predicate: (TYP) -> Boolean)
        : Pair<COLL, COLL> {
    for (item in this) {
        if (predicate(item)) {
            list1.add(item)
        } else {
            list2.add(item)
        }
    }
    return Pair(list1, list2)
}

jimandreas avatar May 09 '18 06:05 jimandreas

Bro @jimandreas , you are not reading my posts properly. You are just answering for the sake of it. I wrote And I have not touched this file. in my previous post. The tasks should compile individually. I am working on Lesson 1/Task2.kt, why is it checking Lesson 6/Task1 ?

akki777-zz avatar May 09 '18 10:05 akki777-zz

Sorry that I cannot help you. Can another reader attempt to provide help to @akki777 ?

jimandreas avatar May 09 '18 15:05 jimandreas

I have the same issue with all the Koans. I'm trying to get it running on gradle with Java 10, but I'm beginning to suspect this is the issue. Is there anywhere we can see the supported JVM numbers?

stiofand avatar May 14 '18 16:05 stiofand

I guess no one from the team cares to look into this or other issues. @svtk

akki777-zz avatar Jun 04 '18 06:06 akki777-zz

Many things here. About the initial problem with the Edu plugin. I've added a new issue https://youtrack.jetbrains.com/issue/EDU-1500, please provide more details there. That looks like a bug, but we need more details of how exactly to reproduce it (which versions of everything etc).

Another issue with tests: https://youtrack.jetbrains.com/issue/EDU-1005.

About Java versions: should work with all Java versions, but I can't guarantee that's not another bug with Java 10. @stevematdavies, if you could provide more details in the issue, we can check.

Sorry if I missed something. Edu plugin issues should be discussed in the tracker, where the plugin team can check that. So if other problems occur, please provide the details there. Thanks!

svtk avatar Jun 04 '18 10:06 svtk

I got this problem also when I work on Lesson 1/Task2.kt, when I click Check, it tips compilation failed.

can anyone help me ? note: I work on android studio V3.4.1, and my PC is windows 7

ryanlijianchang avatar Jun 14 '19 12:06 ryanlijianchang

I got this problem also when I work on Lesson 1/Task2.kt, when I click Check, it tips compilation failed.

can anyone help me ? note: I work on android studio V3.4.1, and my PC is windows 7

I have the same problem and my Android Studio version is 3.5.1

xiaowx2010 avatar Oct 10 '19 07:10 xiaowx2010

I got this problem also when I work on Lesson 1/Task2.kt, when I click Check, it tips compilation failed. can anyone help me ? note: I work on android studio V3.4.1, and my PC is windows 7

I have the same problem and my Android Studio version is 3.5.1

Exactly the same with IntelliJ IDEA 2019.3.4, latest Kotlin and EduTools plugins and jdk1.8.0_191

mictaege avatar Mar 18 '20 09:03 mictaege