error: * is not supported in -source 1.5

20 views
Skip to first unread message

Ken Nichols

unread,
Mar 25, 2018, 3:13:30 PM3/25/18
to App Inventor Open Source Development
I get the following 3 errors when trying to run "ant extensions" to compile my Extension:

error: diamond operator is not supported in -source 1.5
error: try-with-resources is not supported in -source 1.5
error: multi-catch statement is not supported in -source 1.5

It is my understanding that App Inventor requires JDK8 which is the latest that allows for 1.5, so how can I resolve my issues?

Jose Dominguez

unread,
Mar 26, 2018, 4:01:10 AM3/26/18
to app-inventor-open-source-dev
Have you tried not using any of the features that the errors point to?
If they are replaced in the extension it should compile.

cheers,
José
> --
> You received this message because you are subscribed to the Google Groups
> "App Inventor Open Source Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to app-inventor-open-so...@googlegroups.com.
> To post to this group, send email to
> app-inventor-o...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/app-inventor-open-source-dev.
> For more options, visit https://groups.google.com/d/optout.

Ken Nichols

unread,
Mar 26, 2018, 9:43:55 AM3/26/18
to App Inventor Open Source Development
No, I hadn't looked for alternatives because I recieve a total of 77 errors when I try to compile, so honestly I felt a bit overwhelmed.
Thank you for reminding me there is more than 1 way to achieve something!

I believe I have an alternative to the <>Diamond but not sure about an alternative to the "|" or "try-with-resources".
Any suggestions?

Jose Dominguez

unread,
Mar 26, 2018, 10:38:28 AM3/26/18
to app-inventor-open-source-dev
for the multicatch, just add whatever number of catch blocks you need:

try { stuff that can crash } catch (Exception1 ex1) { exception code}
catch (Exception2 e2) {exception2 code}

try {
//code that can generate exceptions
}
catch (ExceptionType1 e1) {

}
catch (ExceptionType2 e2) {

}

For try with resource, the docs provide examples of how code was
written before 1.7:
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

cheers,
José

Jose Dominguez

unread,
Mar 26, 2018, 10:39:38 AM3/26/18
to app-inventor-open-source-dev
Those are two examples of multiple try/catch blocks... meant to delete
the first one, but clicked send too fast!

cheers,
José

Ken Nichols

unread,
Mar 26, 2018, 2:04:12 PM3/26/18
to App Inventor Open Source Development
Thanks, I will attempt to make it work.

Evan Patton

unread,
Apr 3, 2018, 3:19:19 PM4/3/18
to App Inventor Open Source Development
You can also try merging this PR: https://github.com/mit-cml/appinventor-sources/pull/988, but your milage might vary. In particular, I believe that try-with-resources isn't supported at least until Android 5.1, and it may require additional processing of the dex files that we are not performing. I expect the diamond operator should work fine though.

Regards,
Evan

Ken Nichols

unread,
Apr 3, 2018, 4:25:14 PM4/3/18
to App Inventor Open Source Development
Thank you Evan!
I had given up on that particular extension because of all the errors I was getting due to the java version.

I will try this when I get some time.

I was expecting to wait until at least sdk26 compatibility was made.

Reply all
Reply to author
Forward
0 new messages