Cordapp-template compilation issue with Java


(Bikash Sen) #1

Dear Corda Team,

I am using Eclipse as IDE with Gradle plugin and Windows7.

I cloned “corda” project and changed tag using the following commands:

$ git clone https://github.com/corda/corda.git
$ cd corda
$ git checkout -b biksen-corda-branch tags/release-M7.0

My build is successful and ran the following command which is also successful.

$ gradlew.bat install

Now I cloned “cordapp-template” project and changed tag same as corda project using the following commands:

$ git clone https://github.com/corda/cordapp-template.git
$ cd cordapp-template
$ git checkout -b biksen-cordapp-temp-branch tags/release-M7.0

Here, I am getting compilation issues under the Java project within the following Java classess:

  1. com.example.contract.PurchaseOrderContract (at line number 68 and 70)
  2. com.example.contract.PurchaseOrderState (at line number 86)

I am really stuck and looking for suggestion.

Could anyone please suggest how to resolve the issue?? Is this release stable?


(Bikash Sen) #2

Issue with com.example.contract.PurchaseOrderState (at line number 86)

@Override public TransactionBuilder generateAgreement(Party notary) {
return new TransactionType.General().Builder(notary)
.withItems(this, new Command(new Place(), getParticipants()));
}

ERROR:: TransactionType.General.Builder cannot be resolved to a type


(Bikash Sen) #3

Sorry, above code is wrongly pasted. Correct code is below:

@Override public TransactionBuilder generateAgreement(Party notary) {
return new TransactionType.General.Builder(notary)
.withItems(this, new Command(new Place(), getParticipants()));
}

ERROR:: TransactionType.General.Builder cannot be resolved to a type


(Bikash Sen) #4

Dear Corda Team,

I have resolved Java compilation issues by myself :slight_smile: I could not wait for long time.

Slightly changed the “cordapp-template” Java coding using Java reflection to get it passed through compilation. Now it’s working perfectly.


(Joel Dudley) #5

Hi Bikash,

Good to hear you’ve resolved it. It sounds like an issue with your JVM install, since release-M7 has been tested to death at this point.

Make sure it’s updated, and follow the instructions here: https://docs.corda.net/getting-set-up.html#jvm.


(Bikash Sen) #6

Hi Joel,

Thanx! for the reply. I am using Eclipse with JDK8 and Gradle3.1. I just wanted to check whether you have tested Java “cordapp-template” code. Everything working fine excepts 2 to 3 compilation issues. As per the Kotlin compiler, these are OK but as per Java compiler, there are some complaints from compiler. But at runtime, both are working fine.


(Joel Dudley) #7

Yep - definitely compiling fine. Are these just warnings, or are they properly flagged up as errors?

if the example runs fine on your machine, it means the transaction builder was definitely located fine in the end :slight_smile:

I’m not sure if this is an option, but if possible, you should try out IntelliJ IDEA. Because it’s developed by JetBrains, the same people who developed the Kotlin language, it provides first-class Kotlin interop support (I haven’t tried using Eclipse for Kotlin interop myself).


(Deepak Kumar Purohit) #8

For me also it give error on the same place on eclipse but works fine in IntelliJ .


(Bikash Sen) #9

It’s working fine in IntelliJ IDE but compilation problem in Eclipse. I am trying to find out the reason.