Author Message
MichaelNorman
Joined: Jun 3, 2015
Messages: 448
Offline
I have this issue that just popped up out of nowhere. I have OD 7.1 and using the eclipse that comes packaged with it. I recently also installed eclipse neon so that I can start working on Breeze. I have that installed to a different folder, different workspaces etc. That is the only change I can think of making. Recently I attempted an export of an OD project and I see the dreaded error as in the title about source below 1.7.

I managed to quickly copy the tmpbuildscript and sure enough the javac line there is telling it my project is source level 1.5. How can I fix this?

<javac classpathref="project.classpath" debug="${javacDebugInfo}" destdir="${dir.classes}" encoding="UTF-8" failonerror="${javacFailOnError}" includeAntRuntime="no" source="1.5" target="1.5" verbose="${javacVerbose}">
MichaelNorman
Joined: Jun 3, 2015
Messages: 448
Offline
A couple of settings I recently checked are that preferences -> ant -> runtime -> classpath all ponts to jars in the AAOD7_1 folders. I also checked that the Global Entries setting there is set to jdk1.8 folder\lib\tools.jar.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Interesting...we have 1.5 hard coded in the internal build script but I am not seeing problems like this even though I implicitly introduce the <> operator in my code. Can you try adding the following two properties in Preferences->Ant->Runtime->Properties

<property name="java.target" value="1.7" />
<property name="java.source" value="1.7" />

The following link says it works without modifying the build file:

https://stackoverflow.com/questions/22913723/ant-use-source-7-or-higher-to-enable-diamond-operator

Unfortunately, I can't reproduce this problem to give you a solid answer.
MichaelNorman
Joined: Jun 3, 2015
Messages: 448
Offline
Oddly enough if I uncheck "rebuild" and "regenerate" it works. Unforutunately your options did not make a difference. I took the temp build script that I copied out of the project directory, changed source and target to 1.8. Then I copied into the project directory and ran it as an ant build, and it generated the WAR file successfully.

I still can't seem to make this work.

This is the piece of code that is generating the error. Can you create a dummy type and put this in a project and see if it will make it build? The "new ArrayList<>()" is the issue.

public UpdateResponse addMessagesItem(Message messagesItem) {
if (this.messages == null) {
this.messages = new ArrayList<>();
}
this.messages.add(messagesItem);
return this;
}
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Now I see why. You had the Rebuild checked. I never had this checked. I normally have Eclipse automatically build the class when I make any change. By default, the Project->Build Automatically is turned in the Eclipse environment. So when the Rebuild flag is not checked, OD will not run the Rebuild Project target which has the "source=1.5" attribute. This is something we may need to fix in the future to get rid of the obsolete 1.5 support though.
MichaelNorman
Joined: Jun 3, 2015
Messages: 448
Offline
Very interesting. I have always checked this during my exports, but I'll refrain from doing it from now on. Thanks for the info!
pavan.irukuvajula.team.telstra.com
Joined: Feb 6, 2020
Messages: 4
Offline
Similar issue encountered when using Lambda function with Java 1.8 getting error with OD 7.2.3 since ANT build using Java source 1.7.
It seems we need a permanent fix instead of OD hardcoding with Java source it should consider Workspace Java JDK version.
Go to:   
Mobile view