details:   https://code.openbravo.com/erp/devel/pi/rev/e31ad8e9f7e6
changeset: 33870:e31ad8e9f7e6
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu Apr 26 07:46:08 2018 +0200
summary:   fixes 38448: compilation warnings in src-core + buildvalidations 
with JDK10

 JDK version validation is now performed directly in ant without need of 
executing
 and build validation (note checking only if it is 6 as before core was only 
compiled
 with 6, so it would have failed anyway if running with an older one).

 This allows to compile core and build validations with the same JDK as the 
rest.

diffstat:

 build.xml                                                                      
            |    5 +
 src-core/.settings/org.eclipse.jdt.core.prefs                                  
            |   11 -
 src-core/build.xml                                                             
            |    4 +-
 src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java         
            |    9 +-
 src-util/buildvalidation/build.xml                                             
            |    7 +-
 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/JdkVersionCheck.class
 |  Bin 
 
src-util/buildvalidation/src/org/openbravo/buildvalidation/JdkVersionCheck.java 
           |   57 ----------
 7 files changed, 9 insertions(+), 84 deletions(-)

diffs (159 lines):

diff -r d79617fce296 -r e31ad8e9f7e6 build.xml
--- a/build.xml Wed Apr 25 16:14:22 2018 +0200
+++ b/build.xml Thu Apr 26 07:46:08 2018 +0200
@@ -350,6 +350,11 @@
   <target name="init" depends="code.rev">
     <fail if="root.user" message="Don't run ant tasks with the root user" />
     <fail if="no.java.home" message="The environment variable JAVA_HOME is not 
set." />
+    <fail message="Unsupported Java version ${ant.java.version}. Minimum 
required is 7 (1.7).">
+      <condition>
+        <equals arg1="${ant.java.version}" arg2="1.6"/>
+      </condition>
+    </fail>
   </target>
 
   <target name="code.rev" depends="set.code.rev">
diff -r d79617fce296 -r e31ad8e9f7e6 
src-core/.settings/org.eclipse.jdt.core.prefs
--- a/src-core/.settings/org.eclipse.jdt.core.prefs     Wed Apr 25 16:14:22 
2018 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
diff -r d79617fce296 -r e31ad8e9f7e6 src-core/build.xml
--- a/src-core/build.xml        Wed Apr 25 16:14:22 2018 +0200
+++ b/src-core/build.xml        Thu Apr 26 07:46:08 2018 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!--
 
************************************************************************************
-* Copyright (C) 2001-2017 Openbravo S.L.U.
+* Copyright (C) 2001-2018 Openbravo S.L.U.
 * Licensed under the Apache Software License version 2.0
 * You may obtain a copy of the License at 
http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to  in writing,  software  
distributed
@@ -42,7 +42,7 @@
   </target>
 
   <target name="compile" depends="init">
-    <javac srcdir="${build.core.src}" destdir="${build.core}" fork="true" 
deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" 
includeantruntime="false" source="1.6" target="1.6">
+    <javac srcdir="${build.core.src}" destdir="${build.core}" fork="true" 
deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" 
includeantruntime="false">
       <classpath refid="core.class.path"/>  
     </javac>
   </target>
diff -r d79617fce296 -r e31ad8e9f7e6 
src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java
--- a/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java    
Wed Apr 25 16:14:22 2018 +0200
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java    
Thu Apr 26 07:46:08 2018 +0200
@@ -31,14 +31,7 @@
   private static final Logger log4j = 
Logger.getLogger(BuildValidationHandler.class);
 
   /** Prerequisite validations are ensured to be executed before the rest of 
other ones */
-  @SuppressWarnings("serial")
-  private static final List<String> prerequisiteValidations = new 
ArrayList<String>() {
-    {
-      // guarantee current JVM version before executing other validations that 
can be compiled with
-      // a higher version
-      add("org.openbravo.buildvalidation.JdkVersionCheck");
-    }
-  };
+  private static final List<String> prerequisiteValidations = 
Collections.emptyList();
 
   private static File basedir;
   private static String module;
diff -r d79617fce296 -r e31ad8e9f7e6 src-util/buildvalidation/build.xml
--- a/src-util/buildvalidation/build.xml        Wed Apr 25 16:14:22 2018 +0200
+++ b/src-util/buildvalidation/build.xml        Thu Apr 26 07:46:08 2018 +0200
@@ -12,7 +12,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2010-2016 Openbravo SLU
+* All portions are Copyright (C) 2010-2018 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -86,12 +86,7 @@
 
   <target name="javacCore" if="checkCore">
     <javac srcdir="${main.dir}" 
-           includes="src-util/buildvalidation/src/**/JdkVersionCheck.java" 
destdir="${build.validation}" fork="true" deprecation="on" encoding="UTF-8" 
debug="true" debuglevel="lines,vars,source" includeantruntime="false" 
source="1.6" target="1.6">
-      <classpath refid="buildvalidation.class.path" />
-    </javac>
-    <javac srcdir="${main.dir}" 
            includes="src-util/buildvalidation/src/**/*.java"
-           excludes="src-util/buildvalidation/src/**/JdkVersionCheck.java"
            destdir="${build.validation}" fork="true" deprecation="on" 
encoding="UTF-8" debug="true" debuglevel="lines,vars,source" 
includeantruntime="false">
       <classpath refid="buildvalidation.class.path" />
     </javac>
diff -r d79617fce296 -r e31ad8e9f7e6 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/JdkVersionCheck.class
Binary file 
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/JdkVersionCheck.class
 has changed
diff -r d79617fce296 -r e31ad8e9f7e6 
src-util/buildvalidation/src/org/openbravo/buildvalidation/JdkVersionCheck.java
--- 
a/src-util/buildvalidation/src/org/openbravo/buildvalidation/JdkVersionCheck.java
   Wed Apr 25 16:14:22 2018 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- *************************************************************************
- * The contents of this file are subject to the Openbravo  Public  License
- * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
- * Version 1.1  with a permitted attribution clause; you may not  use this
- * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html
- * Software distributed under the License  is  distributed  on  an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific  language  governing  rights  and  limitations
- * under the License.
- * The Original Code is Openbravo ERP.
- * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2016-2017 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.buildvalidation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openbravo.base.ExecutionLimits;
-import org.openbravo.modulescript.OpenbravoVersion;
-
-public class JdkVersionCheck extends BuildValidation {
-  private static final int JAVA7_MAJOR_VERSION = 51;
-
-  @Override
-  public List<String> execute() {
-    ArrayList<String> errors = new ArrayList<String>();
-    try {
-      checkJdkVersion(errors);
-      return errors;
-    } catch (Exception e) {
-      return handleError(e);
-    }
-  }
-
-  private void checkJdkVersion(ArrayList<String> errors) {
-    int majorJavaVersion = new Double(getJavaMajorVersion()).intValue();
-    if (majorJavaVersion < JAVA7_MAJOR_VERSION) {
-      errors.add("Openbravo requires Java 7 (1.7) or higher to work.");
-      errors.add("Current Java version (" + getJavaSpecificationVersion() + ") 
is not supported.");
-    }
-  }
-
-  private String getJavaMajorVersion() {
-    return System.getProperty("java.class.version"); // Java class format 
version number
-  }
-
-  private String getJavaSpecificationVersion() {
-    return System.getProperty("java.specification.version"); // Java Runtime 
Environment
-                                                             // specification 
version
-  }
-}
\ No newline at end of file

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to