[JDK1.6 compatibile task #695 and #676] Update Amino codebase to use JDK 1.6 APIs#811
[JDK1.6 compatibile task #695 and #676] Update Amino codebase to use JDK 1.6 APIs#811maheshrajus wants to merge 5 commits into
Conversation
…codebase to use JDK 1.6 APIs
| if ((JavaVersion.VERSION_1_6 == sourceCompatibility) | ||
| && (System.env.JAVA6_HOME) != null) { | ||
| options.fork = true | ||
| options.bootstrapClasspath = files("$System.env.JAVA6_HOME/jre/lib/rt.jar") |
There was a problem hiding this comment.
Forcing system env var to be fixed JAVA6_HOME for java6 ? It is very stringent. How about programmatically doing that. May be, define a variable in gradle properties for java6 path and override the JAVA_HOME variable Or may be set org.gradle.java.home only for the build context? Or some other way.
…s#676] Update Amino codebase to use JDK 1.6 APIs
| options.bootstrapClasspath = files("$System.env.JAVA6_HOME/jre/lib/rt.jar") | ||
| } | ||
| else { | ||
| options.bootstrapClasspath = files("$System.env.JAVA_HOME/jre/lib/rt.jar") |
There was a problem hiding this comment.
This just silently uses whatever java version is installed on the system? Isn't that exactly the opposite of what you're trying to achieve here?
What you want is to ensure that java 1.6 is installed and used to compile, otherwise generate an error (unless the user explicitly asks to use a different version of java).
There was a problem hiding this comment.
This just silently uses whatever java version is installed on the system? Isn't that exactly the opposite of what you're trying to achieve here?
Here when we set java version to JavaVersion.VERSION_1_6 and set JAVA6_HOME to JDK1.6 path then it will take the first case.
that is --> options.bootstrapClasspath = files("$System.env.JAVA6_HOME/jre/lib/rt.jar")
and it will compile code in 1.6 compatible.
Here JAVA6_HOME should point to JDK1.6
ex: export JAVA6_HOME=/usr/lib/jvm/JDK1.6
What you want is to ensure that java 1.6 is installed and used to compile, otherwise generate an error (unless the user explicitly asks to use a different version of java).
When we have only JAVA 1.6 installed in our system and tries to build then gradle is throwing an error by saying that it requires a 1.7+ java version.
So we are using 1.8 JAVA version for Gradle build and we are enforcing the build to use 1.6 java version by setting the below fields explicitly.
def javaVersion = JavaVersion.VERSION_1_6
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.VERSION_1_6.equals(javaVersion)
&& (System.env.JAVA6_HOME != null) {
options.fork = true
//for 1.6java compatible we have to set JAVA6_HOME to JDK1.6 path
options.bootstrapClasspath = files("$System.env.JAVA6_HOME/jre/lib/rt.jar")
}
else {
options.bootstrapClasspath = files("$System.env.JAVA_HOME/jre/lib/rt.jar")
}
Currently, with JAVA6_HOME setting to JDK1.6 path, we can catch the code which does not comply with java1.6 version.
Here I am working for how we can set options.bootstrapClasspath to JDK1.6/jre/lib/rt.jar path in the JDK1.6 case without system env variable(JAVA6_HOME)
There was a problem hiding this comment.
Please ask @VenuReddy2103 to explain.
My point was that the desired java version to compile Amino with should be explicitly specified somewhere in the gradle config files that users check out of git. And if it's not specified, an error should be generated.
Right now, if someone deletes the statement:
def javaVersion = JavaVersion.VERSION_1_6
or if they do not have JAVA6_HOME set in their environment, it is not well defined which java version will be used to compile with. I different version could be used on each developers' machine, which is what we're trying to avoid.
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| if (this == o) { |
There was a problem hiding this comment.
Not your fault, but neither equals() nor hashCode are correct:
There was a problem hiding this comment.
ok, I will check this and modify
There was a problem hiding this comment.
ScaleUpFrontendPolicy.Config do not inherit LoadBalancedFrontendPolicy.Config. They are independent classes to hold their respective config. So, this generation of equals() and hashCode() using IDE looks correct to me.
quinton-hoole
left a comment
There was a problem hiding this comment.
See inline comment. I don't think this does what it's intended to do?
…#676 ] Update codebase to use JDK 1.6 APIs
|
What is the status here @maheshrajus ? Did you discuss with @VenuReddy2103 ? Is this ready for review yet? |
| sourceCompatibility = javaVersion | ||
| targetCompatibility = javaVersion | ||
| options.bootstrapClasspath = files("$System.env.JAVA_HOME/jre/lib/rt.jar") | ||
| def jdkpath = project.property('jdkPath') |
There was a problem hiding this comment.
nit: Remove these additional tabs
| sourceCompatibility = javaVersion | ||
| targetCompatibility = javaVersion | ||
| options.bootstrapClasspath = files("$System.env.JAVA_HOME/jre/lib/rt.jar") | ||
| def jdkpath = project.property('jdkPath') |
There was a problem hiding this comment.
nit: Rename jdkPath property to jdk6Path
| def jdkpath = project.property('jdkPath') | ||
| def folder = new File(jdkpath) | ||
| if(!folder.exists()) { | ||
| throw new GradleException("JDK 1.6 path does not exist ! Please set the correct 'jdkPath' in gradle.properties file") |
There was a problem hiding this comment.
nit: Suggest string to be something like this - "JDK 1.6 path is not set. Please set 'jdk6Path' project property in gradle.properties file."
| if(!folder.exists()) { | ||
| throw new GradleException("JDK 1.6 path does not exist ! Please set the correct 'jdkPath' in gradle.properties file") | ||
| } | ||
|
|
There was a problem hiding this comment.
I think, we should execute java --version using this JDK(the one with jdk6Path) internally, extract version and check if it is 1.6 or not. If not, throw exception with string - "jdk6Path project property is set with JDK 1.x path. Please set it with JDK 1.6 path."
Discussion Summary:
NOTE: We just need JRE 1.6(actually require only |
…s#676 ] Update codebase to use JDK 1.6 APIs






ex: export JAVA6_HOME=/usr/lib/jvm/jdk1.6.X.X
this we can set in gradle.properties also.
Note:
Document changes we can handle in the issue: #694
Compilation Report:

Sample Error: [when we used lambda expression in Amino.Run code]
